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

test: add stories for chat header #437

Merged
merged 11 commits into from
Dec 10, 2024
64 changes: 64 additions & 0 deletions apps/nextjs/src/components/AppComponents/Chat/header.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import type { Meta, StoryObj } from "@storybook/react";

import { DemoContext } from "@/components/ContextProviders/Demo";

import { chromaticParams } from "../../../../.storybook/chromatic";
import { Header } from "./header";

const DemoDecorator: Story["decorators"] = (Story, { parameters }) => (
<DemoContext.Provider
value={{
isDemoUser: false,
isSharingEnabled: true,
...parameters.demoContext,
}}
>
<Story />
</DemoContext.Provider>
);

const meta: Meta<typeof Header> = {
title: "Components/Layout/ChatHeader",
component: Header,
tags: ["autodocs"],
decorators: [DemoDecorator],
parameters: {
layout: "fullscreen",
...chromaticParams(["legacy"]),
docs: {
story: {
height: "150px",
},
},
},
};

export default meta;
type Story = StoryObj<typeof Header>;

export const Default: Story = {
args: {},
};

export const DemoUser: Story = {
args: {},
parameters: {
demoContext: {
isDemoUser: true,
appSessionsPerMonth: 3,
appSessionsRemaining: 2,
},
...chromaticParams(["legacy", "desktop-wide"]),
},
};

export const DemoLoading: Story = {
args: {},
parameters: {
demoContext: {
isDemoUser: true,
appSessionsPerMonth: 3,
appSessionsRemaining: undefined,
},
},
};
8 changes: 8 additions & 0 deletions apps/nextjs/src/components/Header.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ const meta: Meta<typeof Header> = {
title: "Components/Layout/Header",
component: Header,
tags: ["autodocs"],
parameters: {
layout: "fullscreen",
docs: {
story: {
height: "80px",
},
},
},
};

export default meta;
Expand Down
Loading