-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zintarh
authored and
zintarh
committed
Nov 12, 2024
1 parent
8588ce9
commit 6ab13bc
Showing
10 changed files
with
214 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,5 @@ dist-ssr | |
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
*storybook.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { StorybookConfig } from "@storybook/nextjs"; | ||
|
||
const config: StorybookConfig = { | ||
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], | ||
addons: [ | ||
"@storybook/addon-onboarding", | ||
"@storybook/addon-essentials", | ||
"@chromatic-com/storybook", | ||
"@storybook/addon-interactions", | ||
], | ||
framework: { | ||
name: "@storybook/nextjs", | ||
options: {}, | ||
}, | ||
staticDirs: ["../public"], | ||
}; | ||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import type { Preview } from "@storybook/react"; | ||
import { argent, braavos, jsonRpcProvider, StarknetConfig, useInjectedConnectors } from "@starknet-react/core"; | ||
import { sepolia, Chain } from "@starknet-react/chains"; | ||
import React from "react"; | ||
import "../src/globals.css" | ||
|
||
|
||
const preview: Preview = { | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
|
||
}, | ||
|
||
}, | ||
decorators: [ | ||
(Story) => { | ||
const chains = [sepolia]; | ||
function rpc(chain: Chain) { | ||
return { | ||
nodeUrl: `https://starknet-${chain.network}.public.blastapi.io/rpc/v0_7` | ||
} | ||
} | ||
const provider = jsonRpcProvider({ rpc }); | ||
const { connectors } = useInjectedConnectors({ | ||
recommended: [argent(), braavos()], | ||
order: "random", | ||
}); | ||
return ( | ||
|
||
<StarknetConfig | ||
autoConnect | ||
chains={chains} | ||
provider={provider} | ||
connectors={connectors} | ||
> | ||
<div className="h-[100vh] mt-10 flex flex-col items-center justify-center"> | ||
{Story()} | ||
</div> | ||
|
||
</StarknetConfig> | ||
|
||
) | ||
} | ||
], | ||
}; | ||
|
||
export default preview; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
import { Button } from "../components/ui/Button"; | ||
import { ComponentProps } from "react"; | ||
|
||
type StoryProps = ComponentProps<typeof Button> & { | ||
buttonText: string | ||
}; | ||
|
||
const meta: Meta<StoryProps> = { | ||
title: "Components/Button", | ||
component: Button, | ||
|
||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<StoryProps>; | ||
|
||
export const Primary: Story = { | ||
args: { | ||
buttonText: "Konoha" | ||
}, | ||
render: ({ buttonText, ...args }) => { | ||
return <Button className="w-[200px] h-[46]" {...args} >{buttonText}</Button>; | ||
}, | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
import CommentCard from "../components/CommentCard"; | ||
import { ComponentProps } from "react"; | ||
|
||
type StoryProps = ComponentProps<typeof CommentCard>; | ||
const meta: Meta<StoryProps> = { | ||
title: "Components/CommentCard", | ||
component: CommentCard, | ||
|
||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<StoryProps>; | ||
export const Default: Story = { | ||
args: { | ||
address: "0x05662997723d56add3da71a86105788cb29b4e4e55325c2cc61fb600ac975d80", | ||
text: "Yaaaaaay!!!", | ||
}, | ||
render: (args) => { | ||
return <CommentCard {...args} />; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Meta, StoryObj, } from "@storybook/react"; | ||
import Comments from "../components/Comments"; | ||
import { ComponentProps } from 'react'; | ||
|
||
type StoryProps = ComponentProps<typeof Comments>; | ||
|
||
|
||
|
||
type Story = StoryObj<StoryProps>; | ||
|
||
const meta: Meta<StoryProps> = { | ||
title: "Components/Comments", | ||
component: Comments, | ||
}; | ||
|
||
export default meta; | ||
|
||
|
||
|
||
export const Default: Story = { | ||
args: { | ||
proposalId: "123", | ||
}, | ||
}; | ||
|
||
export const EmptyComments: Story = { | ||
args: { | ||
proposalId: "456", | ||
}, | ||
}; | ||
|
||
export const Loading: Story = { | ||
args: { | ||
proposalId: "789", | ||
}, | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
import Dialog from "../components/ui/Dialog"; | ||
import { ComponentProps } from "react"; | ||
|
||
type StoryProps = ComponentProps<typeof Dialog> & { | ||
buttonText: string | ||
}; | ||
|
||
const meta: Meta<StoryProps> = { | ||
title: "Components/Dialog", | ||
component: Dialog, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<StoryProps>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
buttonText: "Konoha" | ||
}, | ||
render: ({ buttonText, ...args }) => { | ||
return <Dialog {...args} >{buttonText}</Dialog>; | ||
}, | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
import Header from "../components/Header"; | ||
import { ComponentProps } from "react"; | ||
|
||
type StoryProps = ComponentProps<typeof Header>; | ||
const meta: Meta<StoryProps> = { | ||
title: "Components/Header", | ||
component: Header, | ||
}; | ||
export default meta; | ||
type Story = StoryObj<StoryProps>; | ||
|
||
export const Connected: Story = { | ||
render: (args) => <Header {...args} />, | ||
}; | ||
export const NotConnected: Story = { | ||
render: (args) => <Header {...args} />, | ||
}; |