-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d53fe68
commit ee1e6a0
Showing
25 changed files
with
755 additions
and
571 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
77 changes: 77 additions & 0 deletions
77
docs/src/pages/components/speed-dial/OpenIconSpeedDial.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,77 @@ | ||
import React from 'react'; | ||
import { makeStyles, createStyles, Theme } from '@material-ui/core/styles'; | ||
import Button from '@material-ui/core/Button'; | ||
import SpeedDial from '@material-ui/lab/SpeedDial'; | ||
import SpeedDialIcon from '@material-ui/lab/SpeedDialIcon'; | ||
import SpeedDialAction from '@material-ui/lab/SpeedDialAction'; | ||
import FileCopyIcon from '@material-ui/icons/FileCopyOutlined'; | ||
import SaveIcon from '@material-ui/icons/Save'; | ||
import PrintIcon from '@material-ui/icons/Print'; | ||
import ShareIcon from '@material-ui/icons/Share'; | ||
import DeleteIcon from '@material-ui/icons/Delete'; | ||
import EditIcon from '@material-ui/icons/Edit'; | ||
|
||
const useStyles = makeStyles((theme: Theme) => | ||
createStyles({ | ||
root: { | ||
height: 380, | ||
transform: 'translateZ(0px)', | ||
flexGrow: 1, | ||
}, | ||
speedDial: { | ||
position: 'absolute', | ||
bottom: theme.spacing(2), | ||
right: theme.spacing(2), | ||
}, | ||
}), | ||
); | ||
|
||
const actions = [ | ||
{ icon: <FileCopyIcon />, name: 'Copy' }, | ||
{ icon: <SaveIcon />, name: 'Save' }, | ||
{ icon: <PrintIcon />, name: 'Print' }, | ||
{ icon: <ShareIcon />, name: 'Share' }, | ||
{ icon: <DeleteIcon />, name: 'Delete' }, | ||
]; | ||
|
||
export default function OpenIconSpeedDial() { | ||
const classes = useStyles(); | ||
const [open, setOpen] = React.useState(false); | ||
const [hidden, setHidden] = React.useState(false); | ||
|
||
const handleVisibility = () => { | ||
setHidden(prevHidden => !prevHidden); | ||
}; | ||
|
||
const handleOpen = () => { | ||
setOpen(true); | ||
}; | ||
|
||
const handleClose = () => { | ||
setOpen(false); | ||
}; | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<Button onClick={handleVisibility}>Toggle Speed Dial</Button> | ||
<SpeedDial | ||
ariaLabel="SpeedDial openIcon example" | ||
className={classes.speedDial} | ||
hidden={hidden} | ||
icon={<SpeedDialIcon openIcon={<EditIcon />} />} | ||
onClose={handleClose} | ||
onOpen={handleOpen} | ||
open={open} | ||
> | ||
{actions.map(action => ( | ||
<SpeedDialAction | ||
key={action.name} | ||
icon={action.icon} | ||
tooltipTitle={action.name} | ||
onClick={handleClose} | ||
/> | ||
))} | ||
</SpeedDial> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.