Skip to content

Commit

Permalink
Convert the AlertBanner.stories.js to .tsx file (#2424)
Browse files Browse the repository at this point in the history
  • Loading branch information
GurneeshBudhiraja authored Sep 11, 2024
1 parent 9cc6c82 commit e03bf1e
Showing 1 changed file with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import React from "react";
import AlertBanner from "../AlertBanner";
import AlertBanner, { AlertBannerProps } from "../AlertBanner";
import AlertBannerText from "../AlertBannerText/AlertBannerText";
import AlertBannerLink from "../AlertBannerLink/AlertBannerLink";
import AlertBannerButton from "../AlertBannerButton/AlertBannerButton";
import { createStoryMetaSettingsDecorator } from "../../../storybook/functions/createStoryMetaSettingsDecorator";
import "./AlertBanner.stories.scss";
import { Meta, StoryObj } from "@storybook/react";

const metaSettings = createStoryMetaSettingsDecorator({
component: AlertBanner,
enumPropNamesArray: ["backgroundColor"]
});

const alertBannerTemplate = args => {
const alertBannerTemplate = (args: AlertBannerProps) => {
return (
<AlertBanner {...args}>
<AlertBannerText text={args.bannerText} />
<AlertBannerLink text={args.linkText} href="https://monday.com" />
<AlertBannerText text="Alert banner message" />
<AlertBannerLink text="this is a CTA" href="https://monday.com" />
</AlertBanner>
);
};
Expand All @@ -25,7 +26,7 @@ export default {
component: AlertBanner,
argTypes: metaSettings.argTypes,
decorators: metaSettings.decorators
};
} satisfies Meta<typeof AlertBanner>;

export const Overview = {
render: alertBannerTemplate.bind({}),
Expand All @@ -38,7 +39,9 @@ export const Overview = {
}
};

export const Types = {
type Story = StoryObj<typeof AlertBanner>;

export const Types: Story = {
render: () => (
<div className="monday-storybook-alert-banner_column-wrapper monday-storybook-alert-banner_big-container">
<AlertBanner>
Expand Down Expand Up @@ -67,7 +70,7 @@ export const Types = {
name: "Types"
};

export const AlertBannerWithButton = {
export const AlertBannerWithButton: Story = {
render: () => (
<AlertBanner className="monday-storybook-alert-banner_big-container">
<AlertBannerText text="Lorem ipsum dolor sit amet" />
Expand All @@ -78,7 +81,7 @@ export const AlertBannerWithButton = {
name: "Alert Banner with button"
};

export const AlertBannerWithLink = {
export const AlertBannerWithLink: Story = {
render: () => (
<AlertBanner className="monday-storybook-alert-banner_big-container">
<AlertBannerText text="Alert banner message" />
Expand All @@ -89,7 +92,7 @@ export const AlertBannerWithLink = {
name: "Alert Banner with link"
};

export const AlertBannerAsAnAnnouncement = {
export const AlertBannerAsAnAnnouncement: Story = {
render: () => (
<AlertBanner
backgroundColor={AlertBanner.backgroundColors.DARK}
Expand All @@ -103,7 +106,7 @@ export const AlertBannerAsAnAnnouncement = {
name: "Alert banner as an announcement"
};

export const AlertBannerAsAnOpportunityToUpgrade = {
export const AlertBannerAsAnOpportunityToUpgrade: Story = {
render: () => (
<AlertBanner className="monday-storybook-alert-banner_big-container">
<AlertBannerText text="7 days left on your monday CRM trial" />
Expand All @@ -114,7 +117,7 @@ export const AlertBannerAsAnOpportunityToUpgrade = {
name: "Alert banner as an opportunity to upgrade"
};

export const OverflowText = {
export const OverflowText: Story = {
render: () => (
<AlertBanner className="monday-storybook-alert-banner_small-container">
<AlertBannerText text="This is a really long alert..." />
Expand Down

0 comments on commit e03bf1e

Please sign in to comment.