Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs][base] Move styles to the bottom of demos code for FormControl #36579

Merged
merged 3 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
);
}