Skip to content

Commit

Permalink
fix: Fix dissmissability of InfoBox
Browse files Browse the repository at this point in the history
  • Loading branch information
borisrorsvort committed Nov 20, 2019
1 parent 2eb8a79 commit fa37610
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
18 changes: 10 additions & 8 deletions src/components/InfoBox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className={classNames(classes.root, props.className)}>
<Icon className={classes.icon} />
Expand All @@ -50,13 +50,15 @@ const InfoBox = props => {
>
{props.children || props.text}
</Typography>
<IconButton
size="small"
className={classes.closeIcon}
onClick={() => setCookie(cookieName, true)}
>
<CloseIcon className={classes.smallIcon} />
</IconButton>
{props.dismissable && (
<IconButton
size="small"
className={classes.closeIcon}
onClick={() => setCookie(cookieName, true)}
>
<CloseIcon className={classes.smallIcon} />
</IconButton>
)}
</div>
);
} else {
Expand Down
12 changes: 11 additions & 1 deletion src/components/InfoBox/index.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { InfoBox } from "../../index";

export default { title: "Info box" };

export const info = () => (
export const dismissable = () => (
<ThemeProvider theme={theme}>
<InfoBox name="demo-example">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Ducimus ipsam
Expand All @@ -15,3 +15,13 @@ export const info = () => (
</InfoBox>
</ThemeProvider>
);
export const nonDismissable = () => (
<ThemeProvider theme={theme}>
<InfoBox name="demo-example" dismissable={false}>
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?
</InfoBox>
</ThemeProvider>
);

0 comments on commit fa37610

Please sign in to comment.