Skip to content

Commit 4c8585e

Browse files
authored
Merge pull request #13189 from tutizaraz/add-bugbountybanner-story
add story for DismissableBanner component [Fixes #13044]
2 parents 0b7eae4 + b5182ea commit 4c8585e

File tree

3 files changed

+58
-2
lines changed

3 files changed

+58
-2
lines changed

src/components/Banners/BugBountyBanner.tsx renamed to src/components/Banners/BugBountyBanner/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from "react"
33
import { Center, Text } from "@chakra-ui/react"
44

55
// Components
6-
import BannerNotification from "../BannerNotification"
6+
import BannerNotification from "@/components/BannerNotification"
77

88
const BugBountyBanner = () => (
99
<BannerNotification shouldShow>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import React from "react"
2+
import { FaInfoCircle } from "react-icons/fa"
3+
import { Center, Container, Icon, Text } from "@chakra-ui/react"
4+
import { Meta, StoryObj } from "@storybook/react"
5+
6+
import DismissableBanner from "."
7+
8+
const meta = {
9+
title: "Molecules / Navigation / DismissableBanner",
10+
component: DismissableBanner,
11+
parameters: {
12+
layout: "fullscreen",
13+
},
14+
decorators: [
15+
(Story) => (
16+
<Container mx="auto" maxW="1504px">
17+
<Story />
18+
</Container>
19+
),
20+
],
21+
} satisfies Meta<typeof DismissableBanner>
22+
23+
export default meta
24+
type Story = StoryObj<typeof meta>
25+
26+
export const Basic: Story = {
27+
args: {
28+
storageKey: "dismissable-banner-1",
29+
children: <Text>This is a dismissable banner notification.</Text>,
30+
},
31+
}
32+
33+
export const WithLongText: Story = {
34+
args: {
35+
storageKey: "dismissable-banner-2",
36+
children: (
37+
<Text>
38+
This is a dismissable banner with a very long text content to see how it
39+
handles overflow and wrapping. It should be able to manage the text
40+
properly without breaking the layout.
41+
</Text>
42+
),
43+
},
44+
}
45+
46+
export const WithIcon: Story = {
47+
args: {
48+
storageKey: "dismissable-banner-3",
49+
children: (
50+
<Center>
51+
<Icon as={FaInfoCircle} mr={2} />
52+
This banner includes an icon.
53+
</Center>
54+
),
55+
},
56+
}

src/components/Banners/DismissableBanner.tsx renamed to src/components/Banners/DismissableBanner/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { useEffect, useState } from "react"
33
import { Center, CloseButton } from "@chakra-ui/react"
44

55
// Components
6-
import BannerNotification from "../BannerNotification"
6+
import BannerNotification from "@/components/BannerNotification"
77

88
// Interface
99
export type DismissableBannerProps = {

0 commit comments

Comments
 (0)