Skip to content

Commit

Permalink
Merge pull request #1321 from Bynder/GC-3452-set-unread-notification-…
Browse files Browse the repository at this point in the history
…blip-on-page-load

GC-3452 Control Notification Blip visibility with visible prop
  • Loading branch information
lewishankinson authored Nov 16, 2023
2 parents cbe86a1 + cfcd032 commit 4e0dd6d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 7 additions & 2 deletions lib/Notification/blip/NotificationBlip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ import cx from 'classnames';

interface Props {
children: React.ReactNode;
visible: boolean;
className?: string;
}

export function NotificationBlip({ children, className }: Props) {
const classes = cx('notification-blip', className);
export function NotificationBlip({ children, visible, className }: Props) {
const classes = cx(
'notification-blip',
visible ? 'after:opacity-1' : 'after:opacity-0',
className,
);
return <div className={classes}>{children}</div>;
}
8 changes: 5 additions & 3 deletions stories/components/NotificationBlip.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import React from "react";
import { Button, ButtonIcon } from "../../lib";
import { Icon } from "../../lib";
import { ButtonIcon } from "../../lib";
import { NotificationBlip as NotificationBlipComponent } from "../../lib/Notification/blip/NotificationBlip";
import StoryItem from "../styleguide/StoryItem";

export default {
title: 'GUI/Notification Blip',
component: NotificationBlipComponent,
args: {
visible: true,
}
};

export const NotificationBlip = (args: any) => <>
<StoryItem
title="Notification blip"
description="A visual indicator to inform the user they have notifications"
>
<NotificationBlipComponent>
<NotificationBlipComponent visible={args.visible} className={args.className}>
<ButtonIcon name={'bell'} />
</NotificationBlipComponent>
</StoryItem>
Expand Down

0 comments on commit 4e0dd6d

Please sign in to comment.