Skip to content

Commit 78b6d51

Browse files
authored
docs: fix incorrect docs for complex mdx components (#10212)
1 parent 181fc41 commit 78b6d51

File tree

2 files changed

+59
-87
lines changed

2 files changed

+59
-87
lines changed

docs/admin/hooks.mdx

Lines changed: 50 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ The `useForm` hook returns an object with the following properties:
176176
rows={[
177177
[
178178
{
179-
value: `<strong><code>fields</code></strong>`,
179+
value: "**`fields`**",
180180
},
181181
{
182182
value: "Deprecated. This property cannot be relied on as up-to-date.",
@@ -187,7 +187,7 @@ The `useForm` hook returns an object with the following properties:
187187
],
188188
[
189189
{
190-
value: `<strong><code>submit</code></strong>`,
190+
value: "**`submit`**",
191191
},
192192
{
193193
value: "Method to trigger the form to submit",
@@ -198,7 +198,7 @@ The `useForm` hook returns an object with the following properties:
198198
],
199199
[
200200
{
201-
value: `<strong><code>dispatchFields</code></strong>`,
201+
value: "**`dispatchFields`**",
202202
},
203203
{
204204
value: "Dispatch actions to the form field state",
@@ -209,7 +209,7 @@ The `useForm` hook returns an object with the following properties:
209209
],
210210
[
211211
{
212-
value: `<strong><code>validateForm</code></strong>`,
212+
value: "**`validateForm`**",
213213
},
214214
{
215215
value: "Trigger a validation of the form state",
@@ -220,18 +220,18 @@ The `useForm` hook returns an object with the following properties:
220220
],
221221
[
222222
{
223-
value: `<strong><code>createFormData</code></strong>`,
223+
value: "**`createFormData`**",
224224
},
225225
{
226-
value: `<>Create a <code>multipart/form-data</code> object from the current form's state</>`,
226+
value: "Create a `multipart/form-data` object from the current form's state",
227227
},
228228
{
229229
value: ''
230230
}
231231
],
232232
[
233233
{
234-
value: `<strong><code>disabled</code></strong>`,
234+
value: "**`disabled`**",
235235
},
236236
{
237237
value: "Boolean denoting whether or not the form is disabled",
@@ -242,7 +242,7 @@ The `useForm` hook returns an object with the following properties:
242242
],
243243
[
244244
{
245-
value: `<strong><code>getFields</code></strong>`,
245+
value: "**`getFields`**",
246246
},
247247
{
248248
value: 'Gets all fields from state',
@@ -253,7 +253,7 @@ The `useForm` hook returns an object with the following properties:
253253
],
254254
[
255255
{
256-
value: `<strong><code>getField</code></strong>`,
256+
value: "**`getField`**",
257257
},
258258
{
259259
value: 'Gets a single field from state by path',
@@ -264,7 +264,7 @@ The `useForm` hook returns an object with the following properties:
264264
],
265265
[
266266
{
267-
value: `<strong><code>getData</code></strong>`,
267+
value: "**`getData`**",
268268
},
269269
{
270270
value: 'Returns the data stored in the form',
@@ -275,7 +275,7 @@ The `useForm` hook returns an object with the following properties:
275275
],
276276
[
277277
{
278-
value: `<strong><code>getSiblingData</code></strong>`,
278+
value: "**`getSiblingData`**",
279279
},
280280
{
281281
value: 'Returns form sibling data for the given field path',
@@ -286,40 +286,40 @@ The `useForm` hook returns an object with the following properties:
286286
],
287287
[
288288
{
289-
value: `<strong><code>setModified</code></strong>`,
289+
value: "**`setModified`**",
290290
},
291291
{
292-
value: `<>Set the form\'s <code>modified</code> state</>`,
292+
value: "Set the form\'s `modified` state",
293293
},
294294
{
295295
value: '',
296296
},
297297
],
298298
[
299299
{
300-
value: `<strong><code>setProcessing</code></strong>`,
300+
value: "**`setProcessing`**",
301301
},
302302
{
303-
value: `<>Set the form\'s <code>processing</code> state</>`,
303+
value: "Set the form\'s `processing` state",
304304
},
305305
{
306306
value: '',
307307
},
308308
],
309309
[
310310
{
311-
value: `<strong><code>setSubmitted</code></strong>`,
311+
value: "**`setSubmitted`**",
312312
},
313313
{
314-
value: `<>Set the form\'s <code>submitted</code> state</>`,
314+
value: "Set the form\'s `submitted` state",
315315
},
316316
{
317317
value: '',
318318
},
319319
],
320320
[
321321
{
322-
value: `<strong><code>formRef</code></strong>`,
322+
value: "**`formRef`**",
323323
},
324324
{
325325
value: 'The ref from the form HTML element',
@@ -330,7 +330,7 @@ The `useForm` hook returns an object with the following properties:
330330
],
331331
[
332332
{
333-
value: `<strong><code>reset</code></strong>`,
333+
value: "**`reset`**",
334334
},
335335
{
336336
value: 'Method to reset the form to its initial state',
@@ -341,7 +341,7 @@ The `useForm` hook returns an object with the following properties:
341341
],
342342
[
343343
{
344-
value: `<strong><code>addFieldRow</code></strong>`,
344+
value: "**`addFieldRow`**",
345345
},
346346
{
347347
value: "Method to add a row on an array or block field",
@@ -351,7 +351,6 @@ The `useForm` hook returns an object with the following properties:
351351
drawerDescription: 'A useful method to programmatically add a row to an array or block field.',
352352
drawerSlug: 'addFieldRow',
353353
drawerContent: `
354-
<>
355354
<TableWithDrawers
356355
columns={[
357356
'Prop',
@@ -360,23 +359,23 @@ The `useForm` hook returns an object with the following properties:
360359
rows={[
361360
[
362361
{
363-
value: <strong><code>path</code></strong>,
362+
value: "**\`path\`**",
364363
},
365364
{
366365
value: "The path to the array or block field",
367366
},
368367
],
369368
[
370369
{
371-
value: <strong><code>rowIndex</code></strong>,
370+
value: "**\`rowIndex\`**",
372371
},
373372
{
374373
value: "The index of the row to add. If omitted, the row will be added to the end of the array.",
375374
},
376375
],
377376
[
378377
{
379-
value: <strong><code>data</code></strong>,
378+
value: "**\`data<\`**",
380379
},
381380
{
382381
value: "The data to add to the row",
@@ -385,13 +384,8 @@ The `useForm` hook returns an object with the following properties:
385384
]}
386385
/>
387386
388-
{' '}
389387
390-
<br />
391-
392-
{' '}
393-
394-
<pre>
388+
\`\`\`tsx
395389
{\`import { useForm } from "payload/components/forms";
396390
397391
export const CustomArrayManager = () => {
@@ -416,10 +410,11 @@ export const CustomArrayManager = () => {
416410
</button>
417411
)
418412
}\`}
419-
</pre>
413+
\`\`\`
414+
415+
An example config to go along with the Custom Component
420416
421-
<p>An example config to go along with the Custom Component</p>
422-
<pre>
417+
\`\`\`tsx
423418
{\`const ExampleCollection = {
424419
slug: "example-collection",
425420
fields: [
@@ -444,14 +439,13 @@ export const CustomArrayManager = () => {
444439
},
445440
],
446441
}\`}
447-
</pre>
448-
</>
449-
`
442+
\`\`\`
443+
`
450444
}
451445
],
452446
[
453447
{
454-
value: `<strong><code>removeFieldRow</code></strong>`,
448+
value: "**`removeFieldRow`**",
455449
},
456450
{
457451
value: "Method to remove a row from an array or block field",
@@ -461,7 +455,6 @@ export const CustomArrayManager = () => {
461455
drawerDescription: 'A useful method to programmatically remove a row from an array or block field.',
462456
drawerSlug: 'removeFieldRow',
463457
drawerContent: `
464-
<>
465458
<TableWithDrawers
466459
columns={[
467460
'Prop',
@@ -470,15 +463,15 @@ export const CustomArrayManager = () => {
470463
rows={[
471464
[
472465
{
473-
value: <strong><code>path</code></strong>,
466+
value: "**\`path\`**",
474467
},
475468
{
476469
value: "The path to the array or block field",
477470
},
478471
],
479472
[
480473
{
481-
value: <strong><code>rowIndex</code></strong>,
474+
value: "**\`rowIndex\`**",
482475
},
483476
{
484477
value: "The index of the row to remove",
@@ -487,13 +480,9 @@ export const CustomArrayManager = () => {
487480
]}
488481
/>
489482
490-
{' '}
491483
492-
<br />
493484
494-
{' '}
495-
496-
<pre>
485+
\`\`\`tsx
497486
{\`import { useForm } from "payload/components/forms";
498487
499488
export const CustomArrayManager = () => {
@@ -513,10 +502,11 @@ export const CustomArrayManager = () => {
513502
</button>
514503
)
515504
}\`}
516-
</pre>
505+
\`\`\`
506+
507+
An example config to go along with the Custom Component
517508
518-
<p>An example config to go along with the Custom Component</p>
519-
<pre>
509+
\`\`\`tsx
520510
{\`const ExampleCollection = {
521511
slug: "example-collection",
522512
fields: [
@@ -541,14 +531,13 @@ export const CustomArrayManager = () => {
541531
},
542532
],
543533
}\`}
544-
</pre>
545-
</>
546-
`
534+
\`\`\`
535+
`
547536
}
548537
],
549538
[
550539
{
551-
value: `<strong><code>replaceFieldRow</code></strong>`,
540+
value: "**`replaceFieldRow`**",
552541
},
553542
{
554543
value: "Method to replace a row from an array or block field",
@@ -558,7 +547,6 @@ export const CustomArrayManager = () => {
558547
drawerDescription: 'A useful method to programmatically replace a row from an array or block field.',
559548
drawerSlug: 'replaceFieldRow',
560549
drawerContent: `
561-
<>
562550
<TableWithDrawers
563551
columns={[
564552
'Prop',
@@ -567,23 +555,23 @@ export const CustomArrayManager = () => {
567555
rows={[
568556
[
569557
{
570-
value: <strong><code>path</code></strong>,
558+
value: "**\`path\`**",
571559
},
572560
{
573561
value: "The path to the array or block field",
574562
},
575563
],
576564
[
577565
{
578-
value: <strong><code>rowIndex</code></strong>,
566+
value: "**\`rowIndex\`**",
579567
},
580568
{
581569
value: "The index of the row to replace",
582570
},
583571
],
584572
[
585573
{
586-
value: <strong><code>data</code></strong>,
574+
value: "**\`data\`**",
587575
},
588576
{
589577
value: "The data to replace within the row",
@@ -592,13 +580,10 @@ export const CustomArrayManager = () => {
592580
]}
593581
/>
594582
595-
{' '}
596583
597-
<br />
598584
599-
{' '}
600585
601-
<pre>
586+
\`\`\`tsx
602587
{\`import { useForm } from "payload/components/forms";
603588
604589
export const CustomArrayManager = () => {
@@ -623,10 +608,11 @@ export const CustomArrayManager = () => {
623608
</button>
624609
)
625610
}\`}
626-
</pre>
611+
\`\`\`
612+
613+
An example config to go along with the Custom Component
627614
628-
<p>An example config to go along with the Custom Component</p>
629-
<pre>
615+
\`\`\`tsx
630616
{\`const ExampleCollection = {
631617
slug: "example-collection",
632618
fields: [
@@ -651,8 +637,7 @@ export const CustomArrayManager = () => {
651637
},
652638
],
653639
}\`}
654-
</pre>
655-
</>
640+
\`\`\`
656641
`
657642
}
658643
],

0 commit comments

Comments
 (0)