Skip to content

Commit

Permalink
Add stories for InfoBox component with default and dark mode variants
Browse files Browse the repository at this point in the history
  • Loading branch information
Adamik10 committed Dec 18, 2024
1 parent 7d32fdc commit 7cb8e11
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions components/shared/infoBox/InfoBox.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import type { Meta, StoryObj } from "@storybook/react"

import { darkModeDecorator } from "@/.storybook/decorators"
import InfoBox from "@/components/shared/infoBox/InfoBox"
import manifestationMock from "@/lib/mocks/manifestation/infoBox.mock"
import workMock from "@/lib/mocks/work/infoBox.mock"
import { useSelectedManifestationStore } from "@/store/selectedManifestation.store"

const meta = {
title: "components/InfoBox",
component: InfoBox,
parameters: {
layout: "centered",
},
decorators: [
Story => {
// Set Zustand state before rendering the story
const { setSelectedManifestation } = useSelectedManifestationStore.getState()
setSelectedManifestation(manifestationMock)

return (
<div className="content-container my-grid-gap-2 flex-row flex-wrap lg:my-grid-gap-half">
<Story />
</div>
)
},
],
argTypes: {
work: {
control: { type: "object" },
},
},
args: {
work: workMock,
},
} satisfies Meta<typeof InfoBox>

export default meta
type Story = StoryObj<typeof meta>

export const Default: Story = {
render: args => <InfoBox {...args} />,
}

export const DarkMode: Story = {
decorators: [darkModeDecorator],
render: args => <InfoBox {...args} />,
}

0 comments on commit 7cb8e11

Please sign in to comment.