Skip to content

Commit

Permalink
[docs][base] Move styles to the bottom of demos code for FormControl (
Browse files Browse the repository at this point in the history
#36579)

Co-authored-by: seunexplicit <[email protected]>
  • Loading branch information
gitstart and seunexplicit authored Apr 3, 2023
1 parent 73e9ba1 commit 1f23d4c
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 136 deletions.
56 changes: 28 additions & 28 deletions docs/data/base/components/form-control/BasicFormControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,15 @@ import InputUnstyled, { inputUnstyledClasses } from '@mui/base/InputUnstyled';
import { styled } from '@mui/system';
import clsx from 'clsx';

const blue = {
100: '#DAECFF',
200: '#80BFFF',
400: '#3399FF',
600: '#0072E5',
};

const grey = {
50: '#F3F6F9',
100: '#E7EBF0',
200: '#E0E3E7',
300: '#CDD2D7',
400: '#B2BAC2',
500: '#A0AAB4',
600: '#6F7E8C',
700: '#3E5060',
800: '#2D3843',
900: '#1A2027',
};
export default function BasicFormControl() {
return (
<FormControlUnstyled defaultValue="" required>
<Label>Name</Label>
<Input />
<HelperText />
</FormControlUnstyled>
);
}

const Input = styled(InputUnstyled)(
({ theme }) => `
Expand Down Expand Up @@ -109,12 +99,22 @@ const HelperText = styled((props) => {
font-size: 0.875rem;
`;

export default function UseFormControl() {
return (
<FormControlUnstyled defaultValue="" required>
<Label>Name</Label>
<Input />
<HelperText />
</FormControlUnstyled>
);
}
const blue = {
100: '#DAECFF',
200: '#80BFFF',
400: '#3399FF',
600: '#0072E5',
};

const grey = {
50: '#F3F6F9',
100: '#E7EBF0',
200: '#E0E3E7',
300: '#CDD2D7',
400: '#B2BAC2',
500: '#A0AAB4',
600: '#6F7E8C',
700: '#3E5060',
800: '#2D3843',
900: '#1A2027',
};
56 changes: 28 additions & 28 deletions docs/data/base/components/form-control/BasicFormControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,15 @@ import InputUnstyled, { inputUnstyledClasses } from '@mui/base/InputUnstyled';
import { styled } from '@mui/system';
import clsx from 'clsx';

const blue = {
100: '#DAECFF',
200: '#80BFFF',
400: '#3399FF',
600: '#0072E5',
};

const grey = {
50: '#F3F6F9',
100: '#E7EBF0',
200: '#E0E3E7',
300: '#CDD2D7',
400: '#B2BAC2',
500: '#A0AAB4',
600: '#6F7E8C',
700: '#3E5060',
800: '#2D3843',
900: '#1A2027',
};
export default function BasicFormControl() {
return (
<FormControlUnstyled defaultValue="" required>
<Label>Name</Label>
<Input />
<HelperText />
</FormControlUnstyled>
);
}

const Input = styled(InputUnstyled)(
({ theme }) => `
Expand Down Expand Up @@ -111,12 +101,22 @@ const HelperText = styled((props: {}) => {
font-size: 0.875rem;
`;

export default function UseFormControl() {
return (
<FormControlUnstyled defaultValue="" required>
<Label>Name</Label>
<Input />
<HelperText />
</FormControlUnstyled>
);
}
const blue = {
100: '#DAECFF',
200: '#80BFFF',
400: '#3399FF',
600: '#0072E5',
};

const grey = {
50: '#F3F6F9',
100: '#E7EBF0',
200: '#E0E3E7',
300: '#CDD2D7',
400: '#B2BAC2',
500: '#A0AAB4',
600: '#6F7E8C',
700: '#3E5060',
800: '#2D3843',
900: '#1A2027',
};
62 changes: 31 additions & 31 deletions docs/data/base/components/form-control/FormControlFunctionChild.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,18 @@ import FormControlUnstyled from '@mui/base/FormControlUnstyled';
import InputUnstyled, { inputUnstyledClasses } from '@mui/base/InputUnstyled';
import { styled } from '@mui/system';

const blue = {
100: '#DAECFF',
200: '#80BFFF',
400: '#3399FF',
600: '#0072E5',
};

const grey = {
50: '#F3F6F9',
100: '#E7EBF0',
200: '#E0E3E7',
300: '#CDD2D7',
400: '#B2BAC2',
500: '#A0AAB4',
600: '#6F7E8C',
700: '#3E5060',
800: '#2D3843',
900: '#1A2027',
};
export default function FormControlFunctionChild() {
return (
<FormControlUnstyled defaultValue="" required>
{({ filled, focused }) => (
<React.Fragment>
<Input className={filled ? 'filled' : ''} />
{filled && !focused && <OkMark></OkMark>}
</React.Fragment>
)}
</FormControlUnstyled>
);
}

const Input = styled(InputUnstyled)(
({ theme }) => `
Expand Down Expand Up @@ -63,15 +56,22 @@ const OkMark = styled('span')`
color: rgba(125, 200, 0, 1);
`;

export default function FormControlFunctionChild() {
return (
<FormControlUnstyled defaultValue="" required>
{({ filled, focused }) => (
<React.Fragment>
<Input className={filled ? 'filled' : ''} />
{filled && !focused && <OkMark></OkMark>}
</React.Fragment>
)}
</FormControlUnstyled>
);
}
const blue = {
100: '#DAECFF',
200: '#80BFFF',
400: '#3399FF',
600: '#0072E5',
};

const grey = {
50: '#F3F6F9',
100: '#E7EBF0',
200: '#E0E3E7',
300: '#CDD2D7',
400: '#B2BAC2',
500: '#A0AAB4',
600: '#6F7E8C',
700: '#3E5060',
800: '#2D3843',
900: '#1A2027',
};
62 changes: 31 additions & 31 deletions docs/data/base/components/form-control/FormControlFunctionChild.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,18 @@ import FormControlUnstyled, {
import InputUnstyled, { inputUnstyledClasses } from '@mui/base/InputUnstyled';
import { styled } from '@mui/system';

const blue = {
100: '#DAECFF',
200: '#80BFFF',
400: '#3399FF',
600: '#0072E5',
};

const grey = {
50: '#F3F6F9',
100: '#E7EBF0',
200: '#E0E3E7',
300: '#CDD2D7',
400: '#B2BAC2',
500: '#A0AAB4',
600: '#6F7E8C',
700: '#3E5060',
800: '#2D3843',
900: '#1A2027',
};
export default function FormControlFunctionChild() {
return (
<FormControlUnstyled defaultValue="" required>
{({ filled, focused }: FormControlUnstyledState) => (
<React.Fragment>
<Input className={filled ? 'filled' : ''} />
{filled && !focused && <OkMark></OkMark>}
</React.Fragment>
)}
</FormControlUnstyled>
);
}

const Input = styled(InputUnstyled)(
({ theme }) => `
Expand Down Expand Up @@ -65,15 +58,22 @@ const OkMark = styled('span')`
color: rgba(125, 200, 0, 1);
`;

export default function FormControlFunctionChild() {
return (
<FormControlUnstyled defaultValue="" required>
{({ filled, focused }: FormControlUnstyledState) => (
<React.Fragment>
<Input className={filled ? 'filled' : ''} />
{filled && !focused && <OkMark></OkMark>}
</React.Fragment>
)}
</FormControlUnstyled>
);
}
const blue = {
100: '#DAECFF',
200: '#80BFFF',
400: '#3399FF',
600: '#0072E5',
};

const grey = {
50: '#F3F6F9',
100: '#E7EBF0',
200: '#E0E3E7',
300: '#CDD2D7',
400: '#B2BAC2',
500: '#A0AAB4',
600: '#6F7E8C',
700: '#3E5060',
800: '#2D3843',
900: '#1A2027',
};
18 changes: 9 additions & 9 deletions docs/data/base/components/form-control/UseFormControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ import FormControlUnstyled, {
useFormControlUnstyledContext,
} from '@mui/base/FormControlUnstyled';

export default function UseFormControl() {
return (
<FormControlUnstyled defaultValue="" required>
<CustomInput />
<ControlStateDisplay />
</FormControlUnstyled>
);
}

function CustomInput() {
const formControlContext = useFormControlUnstyledContext();

Expand Down Expand Up @@ -40,12 +49,3 @@ function ControlStateDisplay() {
</p>
);
}

export default function UseFormControl() {
return (
<FormControlUnstyled defaultValue="" required>
<CustomInput />
<ControlStateDisplay />
</FormControlUnstyled>
);
}
18 changes: 9 additions & 9 deletions docs/data/base/components/form-control/UseFormControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ import FormControlUnstyled, {
useFormControlUnstyledContext,
} from '@mui/base/FormControlUnstyled';

export default function UseFormControl() {
return (
<FormControlUnstyled defaultValue="" required>
<CustomInput />
<ControlStateDisplay />
</FormControlUnstyled>
);
}

function CustomInput() {
const formControlContext = useFormControlUnstyledContext();

Expand Down Expand Up @@ -40,12 +49,3 @@ function ControlStateDisplay() {
</p>
);
}

export default function UseFormControl() {
return (
<FormControlUnstyled defaultValue="" required>
<CustomInput />
<ControlStateDisplay />
</FormControlUnstyled>
);
}

0 comments on commit 1f23d4c

Please sign in to comment.