-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Working button and its variants * add storybook dependency for @csesoc/ui-components and add stories * fix disabled ghost or text button * added changelog * use white dark-mode icon for storybook * Edited config to use absolute imports with alias @ * yeet the data-testid
- Loading branch information
Showing
18 changed files
with
2,610 additions
and
2,052 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
91 changes: 62 additions & 29 deletions
91
apps/storybook/src/stories/examples/button/Button.stories.tsx
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 |
---|---|---|
@@ -1,41 +1,74 @@ | ||
import { ComponentMeta, ComponentStory } from '@storybook/react'; | ||
import React from 'react'; | ||
import React from "react"; | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
import { Button, type ButtonProps } from "@csesoc/ui-components/src/button"; | ||
import DarkModeIcon from "@/assets/icons/dark-mode-white.svg" | ||
|
||
import { Button } from './Button'; | ||
|
||
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export | ||
export default { | ||
title: 'Example/Button', | ||
const meta: Meta<typeof Button> = { | ||
component: Button, | ||
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes | ||
argTypes: { | ||
backgroundColor: { control: 'color' }, | ||
}, | ||
} as ComponentMeta<typeof Button>; | ||
title: "Example/Button", | ||
argTypes: {}, | ||
}; | ||
export default meta; | ||
|
||
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args | ||
const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />; | ||
type Story = StoryObj<typeof Button>; | ||
|
||
export const Primary = Template.bind({}); | ||
// More on args: https://storybook.js.org/docs/react/writing-stories/args | ||
export const Primary: Story = (args: ButtonProps) => ( | ||
<Button {...args} /> | ||
); | ||
Primary.args = { | ||
primary: true, | ||
label: 'Button', | ||
label: "Button", | ||
theme: "light", | ||
type: "primary", | ||
disabled: false, | ||
}; | ||
|
||
export const WithIcon: Story = (args: ButtonProps) => ( | ||
<Button {...args} /> | ||
); | ||
WithIcon.args = { | ||
label: "dark icon", | ||
theme: "light", | ||
type: "primary", | ||
disabled: false, | ||
icon: <img src={DarkModeIcon} alt="dark mode icon" /> | ||
}; | ||
|
||
export const Disabled: Story = (args: ButtonProps) => ( | ||
<Button {...args} /> | ||
); | ||
Disabled.args = { | ||
label: "Disabled button", | ||
theme: "light", | ||
type: "primary", | ||
disabled: true, | ||
}; | ||
|
||
export const Secondary = Template.bind({}); | ||
Secondary.args = { | ||
label: 'Button', | ||
export const DisabledDarkMode: Story = (args: ButtonProps) => ( | ||
<Button {...args} /> | ||
); | ||
DisabledDarkMode.args = { | ||
label: "Dark button", | ||
theme: "dark", | ||
type: "primary", | ||
disabled: true, | ||
}; | ||
|
||
export const Large = Template.bind({}); | ||
Large.args = { | ||
size: 'large', | ||
label: 'Button', | ||
export const Ghost: Story = (args: ButtonProps) => ( | ||
<Button {...args} /> | ||
); | ||
Ghost.args = { | ||
label: "Ghost button", | ||
theme: "light", | ||
type: "ghost", | ||
disabled: false, | ||
}; | ||
|
||
export const Small = Template.bind({}); | ||
Small.args = { | ||
size: 'small', | ||
label: 'Button', | ||
export const Text: Story = (args: ButtonProps) => ( | ||
<Button {...args} /> | ||
); | ||
Text.args = { | ||
label: "Text button", | ||
theme: "light", | ||
type: "text", | ||
disabled: false, | ||
}; |
41 changes: 41 additions & 0 deletions
41
apps/storybook/src/stories/examples/buttonOld/Button.stories.tsx
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,41 @@ | ||
import { ComponentMeta, ComponentStory } from '@storybook/react'; | ||
import React from 'react'; | ||
|
||
import { Button } from './Button'; | ||
|
||
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export | ||
export default { | ||
title: 'Example/ButtonOld', | ||
component: Button, | ||
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes | ||
argTypes: { | ||
backgroundColor: { control: 'color' }, | ||
}, | ||
} as ComponentMeta<typeof Button>; | ||
|
||
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args | ||
const Template: ComponentStory<typeof Button> = (args) => <Button {...args} />; | ||
|
||
export const Primary = Template.bind({}); | ||
// More on args: https://storybook.js.org/docs/react/writing-stories/args | ||
Primary.args = { | ||
primary: true, | ||
label: 'Button', | ||
}; | ||
|
||
export const Secondary = Template.bind({}); | ||
Secondary.args = { | ||
label: 'Button', | ||
}; | ||
|
||
export const Large = Template.bind({}); | ||
Large.args = { | ||
size: 'large', | ||
label: 'Button', | ||
}; | ||
|
||
export const Small = Template.bind({}); | ||
Small.args = { | ||
size: 'small', | ||
label: 'Button', | ||
}; |
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -1,4 +1,11 @@ | ||
{ | ||
"extends": "tsconfig/base.tsconfig.json", | ||
"include": ["src"] | ||
"include": ["src"], | ||
"compilerOptions": { | ||
"jsx": "preserve", | ||
"baseUrl": ".", | ||
"paths": { | ||
"@/*": ["src/*"], | ||
} | ||
}, | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.