Skip to content

Commit 468e381

Browse files
committed
feat: renaming and leaving only available variants
1 parent f54cbe4 commit 468e381

File tree

2 files changed

+17
-25
lines changed

2 files changed

+17
-25
lines changed

packages/react/src/experimental/Banner/index.stories.tsx renamed to packages/react/src/experimental/Alert/index.stories.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import type { Meta, StoryObj } from "@storybook/react"
22
import { fn } from "@storybook/test"
3-
import { Banner } from "./index"
3+
import { Alert } from "./index"
44

5-
const meta: Meta<typeof Banner> = {
6-
component: Banner,
7-
title: "Home/ProjectManagement/Banner",
5+
const meta: Meta<typeof Alert> = {
6+
component: Alert,
7+
title: "Home/Alert",
88
tags: ["autodocs", "experimental"],
99
parameters: {
1010
layout: "centered",
@@ -20,7 +20,7 @@ const meta: Meta<typeof Banner> = {
2020

2121
export default meta
2222

23-
type Story = StoryObj<typeof Banner>
23+
type Story = StoryObj<typeof Alert>
2424

2525
export const Default: Story = {
2626
args: {

packages/react/src/experimental/Banner/index.tsx renamed to packages/react/src/experimental/Alert/index.tsx

+12-20
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,40 @@ import { Button } from "@/components/Actions/Button"
22
import Share from "@/icons/app/Share"
33
import { AlertAvatar } from "../Information/Avatars/AlertAvatar"
44

5-
type BannerProps = {
5+
type AlertProps = {
66
title: string
77
description: string
88
buttonPrimaryLabel: string
99
buttonSecondaryLabel: string
1010
onRequestClick?: () => void
1111
onSeeClick?: () => void
12-
variant: "neutral" | "info" | "warning" | "critical"
12+
variant: "info" | "warning" | "critical"
1313
}
1414

15-
interface BannerType {
15+
interface AlertType {
1616
buttonType: "outline" | "promote" | "critical"
1717
fontColor:
1818
| "text-f1-foreground"
1919
| "text-f1-foreground-info"
2020
| "text-f1-foreground-warning"
2121
| "text-f1-foreground-critical"
2222
backgroundColor:
23-
| "bg-f1-background-secondary"
2423
| "bg-f1-background-info"
2524
| "bg-f1-background-warning"
2625
| "bg-f1-background-critical"
27-
alertType: "info" | "warning" | "positive" | "critical"
26+
alertType: "info" | "warning" | "critical"
2827
}
2928

30-
export const Banner = ({
29+
export const Alert = ({
3130
title,
3231
description,
3332
buttonPrimaryLabel,
3433
buttonSecondaryLabel,
3534
onRequestClick,
3635
onSeeClick,
3736
variant,
38-
}: BannerProps) => {
39-
const bannerType = (): BannerType => {
37+
}: AlertProps) => {
38+
const alertType = (): AlertType => {
4039
switch (variant) {
4140
case "info":
4241
return {
@@ -59,27 +58,20 @@ export const Banner = ({
5958
backgroundColor: "bg-f1-background-critical",
6059
alertType: "critical",
6160
}
62-
default:
63-
return {
64-
buttonType: "outline",
65-
fontColor: "text-f1-foreground",
66-
backgroundColor: "bg-f1-background-secondary",
67-
alertType: "positive",
68-
}
6961
}
7062
}
7163

72-
const bannerVariant = bannerType()
64+
const alertVariant = alertType()
7365

7466
return (
7567
<div
76-
className={`flex w-full flex-col items-start justify-between gap-4 rounded-md ${bannerVariant.backgroundColor} px-3 py-3 text-f1-foreground ring-1 ring-inset ring-f1-border-secondary sm:flex-row sm:items-center sm:px-4`}
68+
className={`flex w-full flex-col items-start justify-between gap-4 rounded-md ${alertVariant.backgroundColor} px-3 py-3 text-f1-foreground ring-1 ring-inset ring-f1-border-secondary sm:flex-row sm:items-center sm:px-4`}
7769
>
7870
<div className="flex flex-row items-center justify-between gap-16">
7971
<div className="flex flex-row gap-4">
80-
<AlertAvatar type={bannerVariant.alertType} />
72+
<AlertAvatar type={alertVariant.alertType} />
8173
<div className="flex flex-col gap-2">
82-
<h3 className={`${bannerVariant.fontColor}`}>{title}</h3>
74+
<h3 className={`${alertVariant.fontColor}`}>{title}</h3>
8375
<p className="text-base text-f1-foreground">{description}</p>
8476
</div>
8577
</div>
@@ -92,7 +84,7 @@ export const Banner = ({
9284
/>
9385
<Button
9486
label={buttonPrimaryLabel}
95-
variant={bannerVariant.buttonType}
87+
variant={alertVariant.buttonType}
9688
onClick={onRequestClick}
9789
/>
9890
</div>

0 commit comments

Comments
 (0)