From fa37610336c230c7f06a789be6e93dabd290f927 Mon Sep 17 00:00:00 2001 From: Boris Rorsvort Date: Wed, 20 Nov 2019 18:24:51 +0100 Subject: [PATCH] =?UTF-8?q?fix:=E2=80=AFFix=20dissmissability=20of=20InfoB?= =?UTF-8?q?ox?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/InfoBox/index.js | 18 ++++++++++-------- src/components/InfoBox/index.stories.js | 12 +++++++++++- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/components/InfoBox/index.js b/src/components/InfoBox/index.js index b2cf807..b460da8 100644 --- a/src/components/InfoBox/index.js +++ b/src/components/InfoBox/index.js @@ -38,7 +38,7 @@ const InfoBox = props => { const cookieName = `blsq-info-box-hesabu-${props.name}`; const [cookies, setCookie] = useCookies([cookieName]); - if (props.dismissable && !cookies[cookieName]) { + if (!props.dismissable || !cookies[cookieName]) { return (
@@ -50,13 +50,15 @@ const InfoBox = props => { > {props.children || props.text} - setCookie(cookieName, true)} - > - - + {props.dismissable && ( + setCookie(cookieName, true)} + > + + + )}
); } else { diff --git a/src/components/InfoBox/index.stories.js b/src/components/InfoBox/index.stories.js index 262f185..44db768 100644 --- a/src/components/InfoBox/index.stories.js +++ b/src/components/InfoBox/index.stories.js @@ -5,7 +5,7 @@ import { InfoBox } from "../../index"; export default { title: "Info box" }; -export const info = () => ( +export const dismissable = () => ( Lorem ipsum dolor sit amet consectetur adipisicing elit. Ducimus ipsam @@ -15,3 +15,13 @@ export const info = () => ( ); +export const nonDismissable = () => ( + + + Lorem ipsum dolor sit amet consectetur adipisicing elit. Ducimus ipsam + sequi tenetur! Sit odio error repellat atque voluptas cum quibusdam + facilis, inventore quod odit eligendi deleniti modi ducimus assumenda + magnam? + + +);