Skip to content

Commit 32e8dd1

Browse files
committed
Remove css import from component mapper examples.
1 parent ee3001b commit 32e8dd1

File tree

4 files changed

+38
-35
lines changed

4 files changed

+38
-35
lines changed

packages/react-renderer-demo/src/app/examples/components/component-mapper/form-fields-mapper-docs.css

Lines changed: 0 additions & 26 deletions
This file was deleted.

packages/react-renderer-demo/src/app/examples/components/component-mapper/form-fields-mapper.js

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,35 @@ import componentTypes from '@data-driven-forms/react-form-renderer/dist/cjs/comp
55
import useFieldApi from '@data-driven-forms/react-form-renderer/dist/cjs/use-field-api';
66
import useFormApi from '@data-driven-forms/react-form-renderer/dist/cjs/use-form-api';
77

8-
//import './form-fields-mapper-docs.css';
8+
const formGroupStyle = {
9+
display: 'flex',
10+
flexDirection: 'column',
11+
marginBottom: 16,
12+
}
13+
14+
const inputStyles = {
15+
width: '100%',
16+
padding: '12px 20px',
17+
margin: '8px 0',
18+
display: 'inline-block',
19+
border: '1px solid #ccc',
20+
borderRadius: 4,
21+
boxSizing: 'border-box',
22+
}
23+
24+
const paragraphStyle = {
25+
marginTop: 0,
26+
marginBottom: 4,
27+
}
28+
29+
const requiredStyle = {
30+
color: 'red',
31+
marginLeft: 2,
32+
}
33+
34+
const errorStyle = {
35+
color: 'orangered'
36+
}
937

1038
const getButtonStyle = (variant) => ({
1139
color: 'White',
@@ -51,11 +79,15 @@ const TextField = (props) => {
5179
...rest
5280
} = useFieldApi(props);
5381
return (
54-
<div className={`ddorg__demo-formGroup ${isRequired ? 'required' : ''} ${error ? 'error' : ''}`}>
55-
<label htmlFor={input.name}>{label}</label>
56-
<input id={input.name} {...input} {...rest} />
57-
{touched && error && <p className="error-text">{error}</p>}
58-
{customProp && <p>This is a custom prop and has nothing to do with form schema</p>}
82+
<div style={{
83+
...formGroupStyle,
84+
...(isRequired && requiredStyle),
85+
...(error && touched && errorStyle)
86+
}}>
87+
<label style={{color: 'initial'}} htmlFor={input.name}>{isRequired && <span style={errorStyle}>*&nbsp;</span>}{label}</label>
88+
<input style={inputStyles} id={input.name} {...input} {...rest} />
89+
{touched && error && <p style={paragraphStyle}>{error}</p>}
90+
{customProp && <p style={{color: 'initial'}}>This is a custom prop and has nothing to do with form schema</p>}
5991
</div>
6092
);
6193
};

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import Layout from '@docs/components/layout';
88
import { MDXProvider } from '@mdx-js/react';
99
import MdxComponents from '@docs/components/mdx/mdx-components';
1010

11-
import '@docs/examples/components/component-mapper/form-fields-mapper-docs.css';
12-
1311
export default class MyApp extends App {
1412
componentDidMount() {
1513
// Remove the server-side injected CSS.

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ Below, you can see an basic implementation of custom component mapper:
7777
<CodeExample
7878
source="components/component-mapper/form-fields-mapper"
7979
mode="preview"
80-
additionalSources="components/component-mapper/form-fields-mapper-docs.css"
8180
/>
8281

8382
</Grid>

0 commit comments

Comments
 (0)