Make all Header's provider clickable
This commit is contained in:
parent
70da5608b3
commit
82cac576e5
|
@ -44,7 +44,7 @@ const styles = () => ({
|
||||||
})
|
})
|
||||||
|
|
||||||
const Layout = openHoc(({
|
const Layout = openHoc(({
|
||||||
open, toggle, classes, providerInfo, providerDetails,
|
open, toggle, clickAway, classes, providerInfo, providerDetails,
|
||||||
}: Props) => (
|
}: Props) => (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<Row className={classes.summary}>
|
<Row className={classes.summary}>
|
||||||
|
@ -61,7 +61,7 @@ const Layout = openHoc(({
|
||||||
<Grow
|
<Grow
|
||||||
{...TransitionProps}
|
{...TransitionProps}
|
||||||
>
|
>
|
||||||
<ClickAwayListener onClickAway={toggle}>
|
<ClickAwayListener onClickAway={clickAway} mouseEvent="onClick" touchEvent={false}>
|
||||||
<List className={classes.root} component="div">
|
<List className={classes.root} component="div">
|
||||||
{providerDetails}
|
{providerDetails}
|
||||||
</List>
|
</List>
|
||||||
|
|
|
@ -54,10 +54,9 @@ class Provider extends React.Component<Props> {
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<div ref={this.myRef} className={classes.root}>
|
<div ref={this.myRef} className={classes.root}>
|
||||||
<Col end="sm" middle="xs" className={classes.provider}>
|
<Col end="sm" middle="xs" className={classes.provider} onClick={toggle}>
|
||||||
{ info }
|
{ info }
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={toggle}
|
|
||||||
disableRipple
|
disableRipple
|
||||||
className={classes.expand}
|
className={classes.expand}
|
||||||
>
|
>
|
||||||
|
|
|
@ -4,9 +4,13 @@ import { withStateHandlers } from 'recompose'
|
||||||
export type Open = {
|
export type Open = {
|
||||||
open: boolean,
|
open: boolean,
|
||||||
toggle: () => void,
|
toggle: () => void,
|
||||||
|
clickAway: () => void,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withStateHandlers(
|
export default withStateHandlers(
|
||||||
() => ({ open: false }),
|
() => ({ open: false }),
|
||||||
{ toggle: ({ open }) => () => ({ open: !open }) },
|
{
|
||||||
|
toggle: ({ open }) => () => ({ open: !open }),
|
||||||
|
clickAway: () => () => ({ open: false }),
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue