Skip to content

Commit 248e4f8

Browse files
committed
Refactor links in mdx
1 parent 7f6b3ca commit 248e4f8

File tree

10 files changed

+32
-45
lines changed

10 files changed

+32
-45
lines changed

packages/react-renderer-demo/src/app/pages/renderer/action-mapper.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import Grid from '@material-ui/core/Grid'
2-
import RouterLink from 'next/link';
3-
import Link from '@material-ui/core/Link';
42
import ListOfContents from '../../src/helpers/list-of-contents';
53

64
<Grid container item>
75
<Grid item xs={12} md={10}>
86

97
# Action Mapper
108

11-
The <RouterLink href="/renderer/renderer-api#optionalprops"><Link href="/renderer/renderer-api#optionalprops">ActionMapper</Link></RouterLink> allows you to map schema props to functions. This is useful when your schema is not written in JavaScript and you cannot use function inside of it, especially for schemas stored in databases.
9+
The [ActionMapper](/renderer/renderer-api#optionalprops) allows you to map schema props to functions. This is useful when your schema is not written in JavaScript and you cannot use function inside of it, especially for schemas stored in databases.
1210

1311
## Mapper
1412

packages/react-renderer-demo/src/app/pages/renderer/component-api.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import Grid from '@material-ui/core/Grid'
2-
import RouterLink from 'next/link';
3-
import Link from '@material-ui/core/Link';
42

53
import ListOfContents from '../../src/helpers/list-of-contents';
64
import ExampleLink from '@docs/components/common/example-link';
@@ -55,7 +53,7 @@ All those components provides a shared group of props:
5553
|isRequired|boolean|Is the field required?|
5654
|isDisabled|boolean|Is the field disabled?|
5755
|isReadOnly|boolean|Is the field readOnly?|
58-
|initialValue|custom|There are two ways how to set initial values in the form: you can use either the <RouterLink href="/renderer/renderer-api"><Link href="/renderer/renderer-api">initialValues</Link></RouterLink> prop for the whole form or you can set the value in the schema for each field separately. For more information, please see [here](https://final-form.org/docs/react-final-form/types/FieldProps#initialvalue).|
56+
|initialValue|custom|There are two ways how to set initial values in the form: you can use either the [initialValues](/renderer/renderer-api) prop for the whole form or you can set the value in the schema for each field separately. For more information, please see [here](https://final-form.org/docs/react-final-form/types/FieldProps#initialvalue).|
5957

6058
## Text field
6159

@@ -187,7 +185,7 @@ Wizard step <br/>
187185
|----|:--:|----------:|
188186
|title|node/string|Step title|
189187
|name|string, number|Uniq name of the step|
190-
|nextStep|object/name of next step|See <RouterLink href="/component-example/wizard"><Link href="/component-example/wizard">wizard documentation</Link></RouterLink>|
188+
|nextStep|object/name of next step|See [wizard documentation](/component-example/wizard)|
191189
|fields|array|An array of form fields|
192190

193191
<ExampleLink to='wizard' />

packages/react-renderer-demo/src/app/pages/renderer/condition.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import Link from 'next/link';
2-
31
import Grid from '@material-ui/core/Grid'
42

53
import ListOfContents from '../../src/helpers/list-of-contents';
@@ -190,7 +188,7 @@ condition: {
190188

191189
## Clearing values
192190

193-
If you need to clear values after switching fields, please see <Link href="/renderer/unmounting"><a href="/renderer/unmounting">here</a></Link>.
191+
If you need to clear values after switching fields, please see [here](/renderer/unmounting).
194192

195193
</Grid>
196194
<Grid item xs={false} md={2}>

packages/react-renderer-demo/src/app/pages/renderer/field-array.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import RouterLink from 'next/link';
2-
import Link from '@material-ui/core/Link';
31
import Grid from '@material-ui/core/Grid'
42
import RawComponent from '@docs/raw-component';
53

@@ -10,7 +8,7 @@ import ListOfContents from '../../src/helpers/list-of-contents';
108

119
# Field Array Provider
1210

13-
Simillarly to <RouterLink href='/renderer/field-provider'><Link href='/renderer/field-provider'>FieldProvider</Link></RouterLink> Data driven forms provide an option how to inlude <a href='https://github.com/final-form/react-final-form-arrays'>React Final Form Arrays</a> in your form. Please visit their documentation to learn about functionality.
11+
Simillarly to [FieldProvider](/renderer/field-provider) Data driven forms provide an option how to inlude [React Final Form Arrays](https://github.com/final-form/react-final-form-arrays) in your form. Please visit their documentation to learn about functionality.
1412

1513
## Using FieldArray
1614

@@ -58,7 +56,7 @@ You don't need to name the nested components, then the values are saved as an ar
5856

5957
# Validators
6058

61-
You can use user a few provided validators (you can also use your <RouterLink href='/renderer/validators'><Link href='/renderer/validators'>own</Link></RouterLink>.)
59+
You can use user a few provided validators (you can also use your [own](/renderer/validators).)
6260

6361
```jsx
6462
MIN_ITEMS_VALIDATOR: ({threshold})

packages/react-renderer-demo/src/app/pages/renderer/form-template.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import Grid from '@material-ui/core/Grid'
22
import RawComponent from '@docs/raw-component';
3-
import RouterLink from 'next/link';
4-
import Link from '@material-ui/core/Link';
53

64
import ListOfContents from '../../src/helpers/list-of-contents';
75

@@ -37,7 +35,7 @@ With using `useFormApi` hook you can get access to all form information and func
3735

3836
## Customize form buttons
3937

40-
You can customize form buttons in your <RouterLink href='/renderer/renderer-api#requiredprops'><Link href='/renderer/renderer-api#requiredprops'>FormTemplate</Link></RouterLink> component
38+
You can customize form buttons in your [FormTemplate](/renderer/renderer-api#requiredprops) component
4139

4240
<RawComponent source="custom-buttons" />
4341

packages/react-renderer-demo/src/app/pages/renderer/initialize-mount.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import Grid from '@material-ui/core/Grid'
2-
import RouterLink from 'next/link';
3-
import Link from '@material-ui/core/Link';
42
import RawComponent from '@docs/raw-component';
53

64
import ListOfContents from '../../src/helpers/list-of-contents';
@@ -14,7 +12,7 @@ Data Driven Forms provides a way how you can easily initialized a field when the
1412

1513
Just pass a `initializeOnMount` prop and set it to `true`.
1614

17-
The field will use the `initialValue` set in the schema (<RouterLink href="/renderer/component-api#formgroupwrappedcomponents"><Link href="/renderer/component-api#formgroupwrappedcomponents">initialValue</Link></RouterLink>) or in the renderer (<RouterLink href="/renderer/renderer-api#optionalprops"><Link href="/renderer/renderer-api#optionalprops">initialValues</Link></RouterLink>).
15+
The field will use the `initialValue` set in the schema ([initialValue](/renderer/component-api#formgroupwrappedcomponents)) or in the renderer ([initialValues](/renderer/renderer-api#optionalprops)).
1816

1917
`initialValue` has higher priority than a value from `initialValues`.
2018

@@ -32,13 +30,13 @@ The field will use the `initialValue` set in the schema (<RouterLink href="/rend
3230

3331
## When to use it?
3432

35-
This feature comes handy if you need change a value when an user traverses a form, which shows and hides fields, and the value is not set by the user. Very useful case is used it wizard forms, where you can set different value for the same input according the way the user went in the wizard form by using this option combined with <RouterLink href="/renderer/component-api#commonpropsforallformfields"><Link href="/renderer/component-api#commonpropsforallformfields">hideField</Link></RouterLink> prop.
33+
This feature comes handy if you need change a value when an user traverses a form, which shows and hides fields, and the value is not set by the user. Very useful case is used it wizard forms, where you can set different value for the same input according the way the user went in the wizard form by using this option combined with [hideField](/renderer/component-api#commonpropsforallformfields) prop.
3634

3735
<RawComponent source="initialize-mount" />
3836

3937
## Clear the value
4038

41-
If you need clear the value after unmounting, you can do it by using <RouterLink href="/renderer/unmounting"><Link href="/renderer/unmounting">clearOnUnmount</Link></RouterLink>.
39+
If you need clear the value after unmounting, you can do it by using [clearOnUnmount](/renderer/unmounting).
4240

4341
</Grid>
4442
<Grid item xs={false} md={2}>

packages/react-renderer-demo/src/app/pages/renderer/renderer-api.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import RouterLink from 'next/link';
2-
import Link from '@material-ui/core/Link';
31
import Grid from '@material-ui/core/Grid'
42

53
import ListOfContents from '../../src/helpers/list-of-contents';
@@ -16,33 +14,33 @@ Form Renderer provides a lot of customization via props.
1614

1715
|Prop|Type|Description|
1816
|----|:--:|----------:|
19-
|<RouterLink href="/renderer/component-mapping"><Link href="/renderer/component-mapping">componentMapper</Link></RouterLink>|object|Defines types of form field components. Field components can change the state of the form.|
20-
|<RouterLink href="/renderer/form-template"><Link href="/renderer/component-mapping">FormTemplate</Link></RouterLink>|Component|Components which defines a template of the form. This component receives two props from the renderer: `formFields` and `schema`. `formFields` is the content of the form. You should wrap this content into your `<form>` component and add form buttons.|
17+
|[componentMapper](/renderer/component-mapping)|object|Defines types of form field components. Field components can change the state of the form.|
18+
|[FormTemplate](/renderer/component-mapping)|Component|Components which defines a template of the form. This component receives two props from the renderer: `formFields` and `schema`. `formFields` is the content of the form. You should wrap this content into your `<form>` component and add form buttons.|
2119
|onSubmit|func|A submit callback which receives two arguments: `values` and `formApi`.|
2220
|schema|object|A schema which defines structure of the form.|
2321

2422
## Optional props
2523

2624
|Prop|Type|Description|Default|
2725
|----|:--:|----------:|------:|
28-
|<RouterLink href="/renderer/action-mapper"><Link href="/renderer/action-mapper">actionMapper</Link></RouterLink>|object|Action mapper allows to map props to functions.||
29-
|<RouterLink href="/renderer/unmounting"><Link href="/renderer/unmounting">clearOnUnmount</Link></RouterLink>|bool|Will clear values of unmounted components. You can also set this to specific component in the form schema.|false|
30-
|<RouterLink href="/renderer/cleared-value"><Link>clearedValue</Link></RouterLink>|any|Value that will be set to field with **initialValue** after deleting it. Useful for forms while editing.|undefined|
26+
|[actionMapper](/renderer/action-mapper)|object|Action mapper allows to map props to functions.||
27+
|[clearOnUnmount](/renderer/unmounting)|bool|Will clear values of unmounted components. You can also set this to specific component in the form schema.|false|
28+
|[clearedValue](/renderer/cleared-value)|any|Value that will be set to field with **initialValue** after deleting it. Useful for forms while editing.|undefined|
3129
|onReset|func|A reset callback. You don't need to manually clear the form values!||
3230
|onCancel|func|A cancel callback, which receives `values` as the first argument.||
3331
|debug|func|A function which will be called with every form update, i.e. `({ values }) => setValues(values)`, please take a look [here](https://final-form.org/docs/react-final-form/types/FormProps#debug)||
3432
|initialValues|object|An object of fields names as keys and values as their values.||
3533
|subscription|object|You can pass your own [subscription](https://final-form.org/docs/react-final-form/types/FormProps#subscription), which will be added to default settings.|`{ pristine: true, submitting: true, valid: true }`|
36-
|<RouterLink href="/renderer/validators"><Link href="/renderer/validators">validate</Link></RouterLink>|func|A function which receives all form values and returns an object with errors.||
37-
|<RouterLink href="/renderer/validators#validatormapper"><Link href="/renderer/validators#validatormapper">validatorMapper</Link></RouterLink>|object|A mapper containing custom validators, it's automatically merged with the default one.||
34+
|[validate](/renderer/validators)|func|A function which receives all form values and returns an object with errors.||
35+
|[validatorMapper](/renderer/validators#validatormapper)|object|A mapper containing custom validators, it's automatically merged with the default one.||
3836

3937
# Schema
4038

41-
The root object of the schema represents the <RouterLink href="/renderer/component-mapping#formwrapper"><Link href="/renderer/component-mapping#formwrapper">Form</Link></RouterLink> component, that needs only this prop:
39+
The root object of the schema represents the Form component, that needs only this prop:
4240

4341
|Prop|Type|Description|
4442
|----|:--:|----------:|
45-
|fields|array of objects|<RouterLink href="/renderer/component-api"><Link href="/renderer/component-api">Components</Link></RouterLink> of the form. Required!|
43+
|fields|array of objects|[Components](/renderer/component-api) of the form. Required!|
4644

4745
You can use all other props in your `formTemplate` components.
4846

packages/react-renderer-demo/src/app/pages/renderer/validators.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import Grid from '@material-ui/core/Grid'
22
import RawComponent from '@docs/raw-component';
3-
import RouterLink from 'next/link';
4-
import Link from '@material-ui/core/Link';
53

64
import ListOfContents from '../../src/helpers/list-of-contents';
75

@@ -60,7 +58,7 @@ If you do not want to trigger the async validator after every stroke, you can us
6058

6159
# Custom validator mapper
6260

63-
If you need to expand default Data Driven Forms validator types, you can use <RouterLink href="/renderer/renderer-api#optionalprops"><Link href="/renderer/renderer-api#optionalprops">validatorMapper</Link></RouterLink>.
61+
If you need to expand default Data Driven Forms validator types, you can use [validatorMapper](/renderer/renderer-api#optionalprops).
6462

6563
```jsx
6664
const customValidatorMapper = {

packages/react-renderer-demo/src/app/src/components/mdx/mdx-components.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import ShareButton from './share-button';
1616
import { makeStyles } from '@material-ui/core/styles';
1717
import { useRouter } from 'next/router';
1818

19+
import RouterLink from 'next/link';
1920
import dynamic from 'next/dynamic';
2021
const CodeEditor = dynamic(import('../code-editor'), {
2122
ssr: false
@@ -87,11 +88,16 @@ const MdxComponents = {
8788
/>
8889
</div>
8990
),
90-
a: ({ href, children }) => (
91-
<Link href={href} rel="noopener noreferrer" target="_blank">
92-
{children}
93-
</Link>
94-
),
91+
a: ({ href, children }) =>
92+
href.startsWith('/') ? (
93+
<RouterLink href={href}>
94+
<Link href={href}>{children}</Link>
95+
</RouterLink>
96+
) : (
97+
<Link href={href} rel="noopener noreferrer" target="_blank">
98+
{children}
99+
</Link>
100+
),
95101
h1: (props) => <Heading {...props} level={4} component="h1" />,
96102
h2: (props) => <Heading {...props} level={5} component="h2" />,
97103
h3: (props) => <Heading {...props} level={6} component="h3" />,

packages/react-renderer-demo/src/app/src/doc-components/pf4-dual-list.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
import RouterLink from 'next/link';
2-
import Link from '@material-ui/core/Link';
3-
41
This a custom component with a custom design. Things can be changed, after official PF4 release.
52

63
**Props**
74

8-
Dual list select is wrapped in a form group, so it accepts all <RouterLink href="/renderer/component-api#formgroupwrappedcomponents"><Link href="/renderer/component-api#formgroupwrappedcomponents">form group props</Link></RouterLink>.
5+
Dual list select is wrapped in a form group, so it accepts all [form group props](/renderer/component-api#formgroupwrappedcomponents).
96

107
|Props|Type|Default|Description|
118
|-----|----|-------|-----------|

0 commit comments

Comments
 (0)