Skip to content

Commit

Permalink
test: add stories for chat header (#437)
Browse files Browse the repository at this point in the history
  • Loading branch information
codeincontext authored Dec 10, 2024
1 parent 1200b1f commit 53fc941
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
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

0 comments on commit 53fc941

Please sign in to comment.