Skip to content

Commit 7109be8

Browse files
committed
Fixed missing global modifier tag on generate code examples.
1 parent 5bf923f commit 7109be8

File tree

6 files changed

+30
-24
lines changed

6 files changed

+30
-24
lines changed

packages/react-renderer-demo/src/app/pages/_document.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ class MyDocument extends Document {
2323
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css" />
2424
<link rel="stylesheet" type="text/css" href="//wpcc.io/lib/1.0.2/cookieconsent.min.css" />
2525
<script src="//wpcc.io/lib/1.0.2/cookieconsent.min.js"></script>
26-
<style dangerouslySetInnerHTML={{__html: `
26+
<style
27+
dangerouslySetInnerHTML={{
28+
__html: `
2729
html {
2830
box-sizing: border-box;
2931
-webkit-font-smoothing: antialiased;
@@ -44,7 +46,9 @@ class MyDocument extends Document {
4446
line-height: 1.43 !important;
4547
letter-spacing: 0.01071em !important;
4648
background-color: #fafafa !important;
47-
}`}} />
49+
}`
50+
}}
51+
/>
4852
</Head>
4953
<body>
5054
<Main />

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,25 @@ A item of the validate array can be:
2020

2121
## Length validators
2222

23-
<CodeExample mode="preview" source= "components/validators/length-validators" />
23+
<CodeExample mode="preview" source="components/validators/length-validators" />
2424

2525
## Number value validators
2626

27-
<CodeExample mode="preview" source= "components/validators/number-validator" />
27+
<CodeExample mode="preview" source="components/validators/number-validator" />
2828

2929
## Pattern validators
3030

31-
<CodeExample mode="preview" source= "components/validators/pattern-validator" />
31+
<CodeExample mode="preview" source="components/validators/pattern-validator" />
3232

3333
## URL validators
3434

35-
<CodeExample mode="preview" source= "components/validators/url-validator" />
35+
<CodeExample mode="preview" source="components/validators/url-validator" />
3636

3737
## Custom function
3838

3939
As validator you can provide your custom function:
4040

41-
<CodeExample mode="preview" source= "components/validators/custom-function" />
41+
<CodeExample mode="preview" source="components/validators/custom-function" />
4242

4343
The function takes `value` as an argument and should return undefined when pasess or string as an error message when fails.
4444

@@ -48,7 +48,7 @@ You can use a Async function as a validator. But it **must be first in the valid
4848

4949
You can either use custom function, or custom validator from validator mapper.
5050

51-
<CodeExample mode="preview" source= "components/validators/async-validator" />
51+
<CodeExample mode="preview" source="components/validators/async-validator" />
5252

5353

5454
Validator inputs and results are being cached so you will get immediate feedback for recurring values before the validation is actually finished.
@@ -130,13 +130,13 @@ By providing `validateOnMount` the validation will be triggered immediately afte
130130
This form of validation enables you to create validation function for whole form. It is useful for some cross validation between multiple fields etc.
131131
Detailed information can be found [here](https://final-form.org/docs/react-final-form/examples/record-level-validation).
132132

133-
<CodeExample mode="preview" source= "components/validators/record-level-validation" />
133+
<CodeExample mode="preview" source="components/validators/record-level-validation" />
134134

135135
# Overwriting default messages
136136

137137
You can either specify message attribute while adding validator or override validation message of specific validator globally via Validators config.
138138

139-
<CodeExample mode="preview" source= "components/validators/global-message" />
139+
<CodeExample mode="preview" source="components/validators/global-message" />
140140

141141
</Grid>
142142
<Grid item xs={false} md={2}>

packages/react-renderer-demo/src/app/scripts/generate-mappers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function copyPageFile(fileName, targetFile) {
2222
}
2323

2424
let result = data.replace(/from '@data-driven-forms\/mui-component-mapper/g, `from '@data-driven-forms/${mapper}-component-mapper`);
25-
result = result.replace('<CodeExample source="', `<CodeExample source="${mapper}/`);
25+
result = result.replace(/source="/g, `source="${mapper}/`);
2626

2727
fs.writeFile(targetFile, result, 'utf8', function(err) {
2828
if (err) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import Footer from './footer';
2424
import dynamic from 'next/dynamic';
2525
import NotificationPanel from './notification-panel';
2626
import MapperMenu from './mapper-menu';
27-
import { getPrefix, getScopedLink } from '../helpers/scoped-links';
27+
import { getScopedLink } from '../helpers/scoped-links';
2828
const DocSearch = dynamic(import('./docsearch'), {
2929
ssr: false
3030
});

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

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,19 @@ export const Heading = ({ level, children, component }) => {
6262
);
6363
};
6464

65+
const MdLink = ({ href, children }) => {
66+
const classes = useHeadingStyles();
67+
return href.startsWith('/') ? (
68+
<RouterLink href={href}>
69+
<Link href={href}>{children}</Link>
70+
</RouterLink>
71+
) : (
72+
<Link className={classes.link} href={href} rel="noopener noreferrer" target="_blank">
73+
{children}
74+
</Link>
75+
);
76+
};
77+
6578
const MdxComponents = {
6679
p: ({ children }) => (
6780
<Typography variant="body1" gutterBottom>
@@ -98,18 +111,7 @@ const MdxComponents = {
98111
</div>
99112
);
100113
},
101-
a: ({ href, children }) => {
102-
const classes = useHeadingStyles();
103-
return href.startsWith('/') ? (
104-
<RouterLink href={href}>
105-
<Link href={href}>{children}</Link>
106-
</RouterLink>
107-
) : (
108-
<Link className={classes.link} href={href} rel="noopener noreferrer" target="_blank">
109-
{children}
110-
</Link>
111-
);
112-
},
114+
a: MdLink,
113115
h1: (props) => <Heading {...props} level={4} component="h1" />,
114116
h2: (props) => <Heading {...props} level={5} component="h2" />,
115117
h3: (props) => <Heading {...props} level={6} component="h3" />,

0 commit comments

Comments
 (0)