-
Notifications
You must be signed in to change notification settings - Fork 9
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
1 parent
dbe8c22
commit 01bfe31
Showing
14 changed files
with
368 additions
and
88 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from "react"; | ||
import type { Meta, StoryFn } from "@storybook/react"; | ||
import { DRepInfoCard } from "@molecules"; | ||
|
||
// Create a mock context with a default value (adjust according to your real context structure) | ||
const CardanoContext = React.createContext({ | ||
dRepIDBech32: "", | ||
}); | ||
|
||
// Define the type for the children prop to fix the TypeScript error | ||
interface MockedProviderProps { | ||
children: React.ReactNode; | ||
} | ||
|
||
// MockedProvider component that provides the mock context value for the stories | ||
const MockedProvider: React.FC<MockedProviderProps> = ({ children }) => ( | ||
<CardanoContext.Provider | ||
value={{ dRepIDBech32: "mockedRandomStringForDRepID" }} | ||
> | ||
{children} | ||
</CardanoContext.Provider> | ||
); | ||
|
||
// Meta configuration for the Storybook | ||
const meta: Meta = { | ||
title: "Example/DRepInfoCard", | ||
component: DRepInfoCard, | ||
decorators: [ | ||
(Story) => ( | ||
<MockedProvider> | ||
<Story /> | ||
</MockedProvider> | ||
), | ||
], // Apply the mock provider as a decorator | ||
}; | ||
|
||
export default meta; | ||
|
||
// Template for creating stories | ||
const Template: StoryFn = (args) => <DRepInfoCard {...args} />; | ||
|
||
// Default story using the Template | ||
export const Default = Template.bind({}); |
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
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
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 { LinkWithIcon } from "@molecules"; | ||
import { ICONS } from "@consts"; | ||
|
||
const meta: Meta<typeof LinkWithIcon> = { | ||
title: "Example/LinkWithIcon", | ||
component: LinkWithIcon, | ||
parameters: { | ||
layout: "centered", | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const Default: StoryObj<typeof LinkWithIcon> = { | ||
args: { | ||
label: "Default Link", | ||
}, | ||
}; | ||
|
||
export const WithCustomIcon: StoryObj<typeof LinkWithIcon> = { | ||
args: { | ||
label: "Custom Icon Link", | ||
icon: <img src={ICONS.link} />, | ||
}, | ||
}; |
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,31 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import { LoadingButton } from "@atoms"; | ||
|
||
const meta = { | ||
title: "Example/LoadingButton", | ||
component: LoadingButton, | ||
parameters: { | ||
layout: "centered", | ||
}, | ||
tags: ["autodocs"], | ||
} satisfies Meta<typeof LoadingButton>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Primary: Story = { | ||
args: { | ||
children: "Button", | ||
variant: "contained", | ||
isLoading: false, | ||
}, | ||
}; | ||
|
||
export const Loading: Story = { | ||
args: { | ||
children: "Button", | ||
variant: "contained", | ||
isLoading: true, | ||
}, | ||
}; |
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,62 @@ | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
import { Button } from "@atoms"; | ||
import OpenInNewIcon from "@mui/icons-material/OpenInNew"; | ||
|
||
import { Field, Step } from "@molecules"; | ||
|
||
const meta: Meta<typeof Step> = { | ||
title: "Example/Step", | ||
component: Step, | ||
parameters: { | ||
layout: "centered", | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const WithButton: StoryObj<typeof Step> = { | ||
args: { | ||
label: "Download this file", | ||
stepNumber: 1, | ||
component: ( | ||
<Button size="extraLarge" sx={{ width: "fit-content" }}> | ||
Info.jsonld | ||
</Button> | ||
), | ||
}, | ||
}; | ||
|
||
export const WithIconButton: StoryObj<typeof Step> = { | ||
args: { | ||
label: | ||
"Save this file in a location that provides a public URL (ex. github)", | ||
stepNumber: 2, | ||
component: ( | ||
<Button | ||
endIcon={ | ||
<OpenInNewIcon | ||
sx={{ | ||
color: "primary", | ||
height: 17, | ||
width: 17, | ||
}} | ||
/> | ||
} | ||
size="extraLarge" | ||
sx={{ width: "fit-content" }} | ||
variant="text" | ||
> | ||
Read full guide | ||
</Button> | ||
), | ||
}, | ||
}; | ||
|
||
export const WithInput: StoryObj<typeof Step> = { | ||
args: { | ||
label: | ||
"Save this file in a location that provides a public URL (ex. github)", | ||
stepNumber: 2, | ||
component: <Field.Input name="storingURL" placeholder={"URL"} />, | ||
}, | ||
}; |
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,42 @@ | ||
import type { Meta, StoryFn } from "@storybook/react"; | ||
|
||
import { Field } from "@molecules"; | ||
import { ComponentProps } from "react"; | ||
|
||
const meta: Meta<typeof Field.TextArea> = { | ||
title: "Example/TextArea", | ||
component: Field.TextArea, | ||
parameters: { | ||
layout: "centered", | ||
}, | ||
tags: ["autodocs"], | ||
}; | ||
|
||
export default meta; | ||
|
||
const Template: StoryFn<ComponentProps<typeof Field.TextArea>> = (args) => { | ||
return <Field.TextArea {...args} />; | ||
}; | ||
|
||
export const Default = Template.bind({}); | ||
|
||
export const WithLabel = Template.bind({}); | ||
WithLabel.args = { | ||
label: "Label", | ||
}; | ||
|
||
export const WithHelpfulText = Template.bind({}); | ||
WithHelpfulText.args = { | ||
helpfulText: "Helpful text here", | ||
}; | ||
|
||
export const Error = Template.bind({}); | ||
Error.args = { | ||
errorMessage: "Error message", | ||
}; | ||
|
||
export const ErrorAndLabel = Template.bind({}); | ||
ErrorAndLabel.args = { | ||
errorMessage: "Error message", | ||
label: "Label", | ||
}; |
Oops, something went wrong.