forked from asyncapi/website
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add stories buttons (asyncapi#3079)
Co-authored-by: Akshat Nema <[email protected]>%0ACo-authored-by: akshatnema <[email protected]>
- Loading branch information
1 parent
8e99276
commit 40a5797
Showing
10 changed files
with
179 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { ButtonIconPosition, ButtonSize, ButtonType } from '@/types/components/buttons/ButtonPropsType'; | ||
|
||
import AsyncAPI from '../icons/AsyncAPI'; | ||
import Button from './Button'; | ||
|
||
const meta: Meta<typeof Button> = { | ||
title: 'Components/Buttons', | ||
component: Button, | ||
argTypes: { | ||
text: { | ||
control: { type: 'text' } | ||
}, | ||
type: { | ||
options: Object.values(ButtonType), | ||
control: { type: 'select' } | ||
}, | ||
buttonSize: { | ||
options: Object.values(ButtonSize), | ||
control: { type: 'select' } | ||
}, | ||
className: { | ||
control: { type: 'text' } | ||
}, | ||
bgClassName: { | ||
control: { type: 'text' } | ||
}, | ||
textClassName: { | ||
control: { type: 'text' } | ||
}, | ||
icon: { | ||
options: ['AsyncAPI Icon'], | ||
mapping: { | ||
'AsyncAPI Icon': <AsyncAPI className='size-6' /> | ||
} | ||
}, | ||
iconPosition: { | ||
options: Object.values(ButtonIconPosition), | ||
control: { type: 'select' } | ||
}, | ||
target: { | ||
control: { type: 'text' } | ||
} | ||
} | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof Button>; | ||
|
||
export const DefaultButton: Story = { | ||
args: { | ||
text: 'Default', | ||
className: 'bg-gray-200 hover:bg-gray-100 text-gray-900' | ||
} | ||
}; | ||
|
||
export const PrimaryButton: Story = { | ||
args: { | ||
text: 'Primary' | ||
} | ||
}; | ||
|
||
export const SecondaryButton: Story = { | ||
args: { | ||
text: 'Secondary', | ||
className: 'border border-secondary-500 bg-secondary-100 text-secondary-500 hover:bg-secondary-500 hover:text-white' | ||
} | ||
}; | ||
|
||
export const SubmitButton: Story = { | ||
args: { | ||
text: 'Submit', | ||
type: ButtonType.SUBMIT | ||
} | ||
}; | ||
|
||
export const ResetButton: Story = { | ||
args: { | ||
text: 'Reset', | ||
type: ButtonType.RESET | ||
} | ||
}; | ||
|
||
export const SmallButton: Story = { | ||
args: { | ||
text: 'Reset', | ||
buttonSize: ButtonSize.SMALL | ||
} | ||
}; | ||
|
||
export const SuccessButton: Story = { | ||
args: { | ||
text: 'Success', | ||
className: 'bg-[#2db84c] hover:bg-[#36de5b]' | ||
} | ||
}; | ||
|
||
export const WarningButton: Story = { | ||
args: { | ||
text: 'Warning', | ||
className: 'bg-[#fbc000] hover:bg-[#ffd400]' | ||
} | ||
}; | ||
|
||
export const ErrorButton: Story = { | ||
args: { | ||
text: 'Error', | ||
className: 'bg-[#e25a71] hover:bg-[#ff6575]' | ||
} | ||
}; | ||
|
||
export const ButtonWithIconOnLeft: Story = { | ||
args: { | ||
text: 'AsyncAPI icon on left', | ||
className: 'flex items-center justify-center', | ||
icon: 'AsyncAPI Icon', | ||
iconPosition: ButtonIconPosition.LEFT | ||
} | ||
}; | ||
|
||
export const ButtonWithIconOnRight: Story = { | ||
args: { | ||
text: 'AsyncAPI icon on right', | ||
className: 'flex items-center justify-center', | ||
icon: 'AsyncAPI Icon', | ||
iconPosition: ButtonIconPosition.RIGHT | ||
} | ||
}; | ||
|
||
export const ButtonWithOnlyIcon: Story = { | ||
args: { | ||
className: 'flex items-center justify-center', | ||
icon: 'AsyncAPI Icon', | ||
iconPosition: ButtonIconPosition.LEFT | ||
} | ||
}; |
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
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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
export enum ButtonSize { | ||
SMALL = 'small', | ||
DEFAULT = 'default', | ||
DEFAULT = 'default' | ||
} | ||
|
||
export enum ButtonType { | ||
SUBMIT = 'submit', | ||
RESET = 'reset', | ||
BUTTON = 'button', | ||
BUTTON = 'button' | ||
} | ||
|
||
export enum ButtonIconPosition { | ||
LEFT = 'left', | ||
RIGHT = 'right', | ||
RIGHT = 'right' | ||
} |
File renamed without changes.