From 82cac576e5709cf344bbef94f80c3c164eeb09af Mon Sep 17 00:00:00 2001 From: apanizo Date: Tue, 16 Oct 2018 12:33:10 +0200 Subject: [PATCH] Make all Header's provider clickable --- src/components/Header/component/Layout.jsx | 4 ++-- src/components/Header/component/Provider.jsx | 3 +-- src/components/hoc/OpenHoc.jsx | 6 +++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/Header/component/Layout.jsx b/src/components/Header/component/Layout.jsx index 83162039..ed1ff217 100644 --- a/src/components/Header/component/Layout.jsx +++ b/src/components/Header/component/Layout.jsx @@ -44,7 +44,7 @@ const styles = () => ({ }) const Layout = openHoc(({ - open, toggle, classes, providerInfo, providerDetails, + open, toggle, clickAway, classes, providerInfo, providerDetails, }: Props) => ( @@ -61,7 +61,7 @@ const Layout = openHoc(({ - + {providerDetails} diff --git a/src/components/Header/component/Provider.jsx b/src/components/Header/component/Provider.jsx index ca18ae35..45df78d2 100644 --- a/src/components/Header/component/Provider.jsx +++ b/src/components/Header/component/Provider.jsx @@ -54,10 +54,9 @@ class Provider extends React.Component { return (
- + { info } diff --git a/src/components/hoc/OpenHoc.jsx b/src/components/hoc/OpenHoc.jsx index 1491c7bf..fa3a62fe 100644 --- a/src/components/hoc/OpenHoc.jsx +++ b/src/components/hoc/OpenHoc.jsx @@ -4,9 +4,13 @@ import { withStateHandlers } from 'recompose' export type Open = { open: boolean, toggle: () => void, + clickAway: () => void, } export default withStateHandlers( () => ({ open: false }), - { toggle: ({ open }) => () => ({ open: !open }) }, + { + toggle: ({ open }) => () => ({ open: !open }), + clickAway: () => () => ({ open: false }), + }, )