Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GC-3452 Control Notification Blip visibility with visible prop #1321

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading