-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(HoverPopper): close when mouse leaves popper
fix #54
- Loading branch information
1 parent
6e3d1ee
commit 30516a8
Showing
5 changed files
with
47 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react' | ||
import Typography from '@material-ui/core/Typography' | ||
import Popper from '@material-ui/core/Popper' | ||
import Button from '@material-ui/core/Button' | ||
import Paper from '@material-ui/core/Paper' | ||
import { | ||
usePopupState, | ||
bindHover, | ||
bindPopper, | ||
} from 'material-ui-popup-state/hooks' | ||
|
||
const HoverPopperPopupState = ({ classes }) => { | ||
const popupState = usePopupState({ | ||
variant: 'popper', | ||
popupId: 'demoPopper', | ||
}) | ||
return ( | ||
<div> | ||
<Button variant="contained" {...bindHover(popupState)}> | ||
Hover to open Popper | ||
</Button> | ||
<Popper {...bindPopper(popupState)} transition> | ||
<Paper> | ||
<Typography style={{ margin: 10 }}> | ||
The content of the Popper. | ||
</Typography> | ||
</Paper> | ||
</Popper> | ||
</div> | ||
) | ||
} | ||
|
||
export default HoverPopperPopupState |
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