-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] BottomNavigation TypeScript docs (#14979)
- Loading branch information
1 parent
8f359dd
commit f7a3e12
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
docs/src/pages/demos/bottom-navigation/LabelBottomNavigation.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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from 'react'; | ||
import { makeStyles, Theme, createStyles } from '@material-ui/core/styles'; | ||
import BottomNavigation from '@material-ui/core/BottomNavigation'; | ||
import BottomNavigationAction from '@material-ui/core/BottomNavigationAction'; | ||
import Icon from '@material-ui/core/Icon'; | ||
import RestoreIcon from '@material-ui/icons/Restore'; | ||
import FavoriteIcon from '@material-ui/icons/Favorite'; | ||
import LocationOnIcon from '@material-ui/icons/LocationOn'; | ||
|
||
const useStyles = makeStyles({ | ||
root: { | ||
width: 500, | ||
}, | ||
}); | ||
|
||
function LabelBottomNavigation() { | ||
const classes = useStyles(); | ||
const [value, setValue] = React.useState('recents'); | ||
|
||
function handleChange(event: React.ChangeEvent<{}>, newValue: string) { | ||
setValue(newValue); | ||
} | ||
|
||
return ( | ||
<BottomNavigation value={value} onChange={handleChange} className={classes.root}> | ||
<BottomNavigationAction label="Recents" value="recents" icon={<RestoreIcon />} /> | ||
<BottomNavigationAction label="Favorites" value="favorites" icon={<FavoriteIcon />} /> | ||
<BottomNavigationAction label="Nearby" value="nearby" icon={<LocationOnIcon />} /> | ||
<BottomNavigationAction label="Folder" value="folder" icon={<Icon>folder</Icon>} /> | ||
</BottomNavigation> | ||
); | ||
} | ||
|
||
export default LabelBottomNavigation; |
35 changes: 35 additions & 0 deletions
35
docs/src/pages/demos/bottom-navigation/SimpleBottomNavigation.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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
import { makeStyles, Theme, createStyles } from '@material-ui/core/styles'; | ||
import BottomNavigation from '@material-ui/core/BottomNavigation'; | ||
import BottomNavigationAction from '@material-ui/core/BottomNavigationAction'; | ||
import RestoreIcon from '@material-ui/icons/Restore'; | ||
import FavoriteIcon from '@material-ui/icons/Favorite'; | ||
import LocationOnIcon from '@material-ui/icons/LocationOn'; | ||
|
||
const useStyles = makeStyles({ | ||
root: { | ||
width: 500, | ||
}, | ||
}); | ||
|
||
function SimpleBottomNavigation() { | ||
const classes = useStyles(); | ||
const [value, setValue] = React.useState(0); | ||
|
||
return ( | ||
<BottomNavigation | ||
value={value} | ||
onChange={(event, newValue) => { | ||
setValue(newValue); | ||
}} | ||
showLabels | ||
className={classes.root} | ||
> | ||
<BottomNavigationAction label="Recents" icon={<RestoreIcon />} /> | ||
<BottomNavigationAction label="Favorites" icon={<FavoriteIcon />} /> | ||
<BottomNavigationAction label="Nearby" icon={<LocationOnIcon />} /> | ||
</BottomNavigation> | ||
); | ||
} | ||
|
||
export default SimpleBottomNavigation; |