forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] Simplify some demos (mui#19608)
- Loading branch information
1 parent
66beeec
commit 5e797e9
Showing
22 changed files
with
519 additions
and
333 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 9 additions & 56 deletions
65
docs/src/pages/components/radio-buttons/RadioButtonsGroup.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,26 @@ | ||
import React from 'react'; | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
import Radio from '@material-ui/core/Radio'; | ||
import RadioGroup from '@material-ui/core/RadioGroup'; | ||
import FormHelperText from '@material-ui/core/FormHelperText'; | ||
import FormControlLabel from '@material-ui/core/FormControlLabel'; | ||
import FormControl from '@material-ui/core/FormControl'; | ||
import FormLabel from '@material-ui/core/FormLabel'; | ||
|
||
const useStyles = makeStyles(theme => ({ | ||
formControl: { | ||
margin: theme.spacing(3), | ||
}, | ||
})); | ||
|
||
export default function RadioButtonsGroup() { | ||
const classes = useStyles(); | ||
const [value, setValue] = React.useState('female'); | ||
|
||
const handleChange = event => { | ||
setValue(event.target.value); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<FormControl component="fieldset" className={classes.formControl}> | ||
<FormLabel component="legend">Gender</FormLabel> | ||
<RadioGroup aria-label="gender" name="gender1" value={value} onChange={handleChange}> | ||
<FormControlLabel value="female" control={<Radio />} label="Female" /> | ||
<FormControlLabel value="male" control={<Radio />} label="Male" /> | ||
<FormControlLabel value="other" control={<Radio />} label="Other" /> | ||
<FormControlLabel | ||
value="disabled" | ||
disabled | ||
control={<Radio />} | ||
label="(Disabled option)" | ||
/> | ||
</RadioGroup> | ||
</FormControl> | ||
<FormControl component="fieldset" className={classes.formControl}> | ||
<FormLabel component="legend">Gender</FormLabel> | ||
<RadioGroup aria-label="gender" name="gender2" value={value} onChange={handleChange}> | ||
<FormControlLabel | ||
value="female" | ||
control={<Radio color="primary" />} | ||
label="Female" | ||
labelPlacement="start" | ||
/> | ||
<FormControlLabel | ||
value="male" | ||
control={<Radio color="primary" />} | ||
label="Male" | ||
labelPlacement="start" | ||
/> | ||
<FormControlLabel | ||
value="other" | ||
control={<Radio color="primary" />} | ||
label="Other" | ||
labelPlacement="start" | ||
/> | ||
<FormControlLabel | ||
value="disabled" | ||
disabled | ||
control={<Radio />} | ||
label="(Disabled option)" | ||
labelPlacement="start" | ||
/> | ||
</RadioGroup> | ||
<FormHelperText>labelPlacement start</FormHelperText> | ||
</FormControl> | ||
</div> | ||
<FormControl component="fieldset"> | ||
<FormLabel component="legend">Gender</FormLabel> | ||
<RadioGroup aria-label="gender" name="gender1" value={value} onChange={handleChange}> | ||
<FormControlLabel value="female" control={<Radio />} label="Female" /> | ||
<FormControlLabel value="male" control={<Radio />} label="Male" /> | ||
<FormControlLabel value="other" control={<Radio />} label="Other" /> | ||
<FormControlLabel value="disabled" disabled control={<Radio />} label="(Disabled option)" /> | ||
</RadioGroup> | ||
</FormControl> | ||
); | ||
} |
67 changes: 9 additions & 58 deletions
67
docs/src/pages/components/radio-buttons/RadioButtonsGroup.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,26 @@ | ||
import React from 'react'; | ||
import { makeStyles, Theme, createStyles } from '@material-ui/core/styles'; | ||
import Radio from '@material-ui/core/Radio'; | ||
import RadioGroup from '@material-ui/core/RadioGroup'; | ||
import FormHelperText from '@material-ui/core/FormHelperText'; | ||
import FormControlLabel from '@material-ui/core/FormControlLabel'; | ||
import FormControl from '@material-ui/core/FormControl'; | ||
import FormLabel from '@material-ui/core/FormLabel'; | ||
|
||
const useStyles = makeStyles((theme: Theme) => | ||
createStyles({ | ||
formControl: { | ||
margin: theme.spacing(3), | ||
}, | ||
}), | ||
); | ||
|
||
export default function RadioButtonsGroup() { | ||
const classes = useStyles(); | ||
const [value, setValue] = React.useState('female'); | ||
|
||
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
setValue((event.target as HTMLInputElement).value); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<FormControl component="fieldset" className={classes.formControl}> | ||
<FormLabel component="legend">Gender</FormLabel> | ||
<RadioGroup aria-label="gender" name="gender1" value={value} onChange={handleChange}> | ||
<FormControlLabel value="female" control={<Radio />} label="Female" /> | ||
<FormControlLabel value="male" control={<Radio />} label="Male" /> | ||
<FormControlLabel value="other" control={<Radio />} label="Other" /> | ||
<FormControlLabel | ||
value="disabled" | ||
disabled | ||
control={<Radio />} | ||
label="(Disabled option)" | ||
/> | ||
</RadioGroup> | ||
</FormControl> | ||
<FormControl component="fieldset" className={classes.formControl}> | ||
<FormLabel component="legend">Gender</FormLabel> | ||
<RadioGroup aria-label="gender" name="gender2" value={value} onChange={handleChange}> | ||
<FormControlLabel | ||
value="female" | ||
control={<Radio color="primary" />} | ||
label="Female" | ||
labelPlacement="start" | ||
/> | ||
<FormControlLabel | ||
value="male" | ||
control={<Radio color="primary" />} | ||
label="Male" | ||
labelPlacement="start" | ||
/> | ||
<FormControlLabel | ||
value="other" | ||
control={<Radio color="primary" />} | ||
label="Other" | ||
labelPlacement="start" | ||
/> | ||
<FormControlLabel | ||
value="disabled" | ||
disabled | ||
control={<Radio />} | ||
label="(Disabled option)" | ||
labelPlacement="start" | ||
/> | ||
</RadioGroup> | ||
<FormHelperText>labelPlacement start</FormHelperText> | ||
</FormControl> | ||
</div> | ||
<FormControl component="fieldset"> | ||
<FormLabel component="legend">Gender</FormLabel> | ||
<RadioGroup aria-label="gender" name="gender1" value={value} onChange={handleChange}> | ||
<FormControlLabel value="female" control={<Radio />} label="Female" /> | ||
<FormControlLabel value="male" control={<Radio />} label="Male" /> | ||
<FormControlLabel value="other" control={<Radio />} label="Other" /> | ||
<FormControlLabel value="disabled" disabled control={<Radio />} label="(Disabled option)" /> | ||
</RadioGroup> | ||
</FormControl> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.