Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
fix(Card): Add Block Layout for Buttons (Full Width)
Browse files Browse the repository at this point in the history
  • Loading branch information
deniaz committed Dec 13, 2022
1 parent 4248bac commit 8987844
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Label } from './label';
type BaseButtonProps = {
color: 'Slate' | 'Violet' | 'Gradient';
size: 'M' | 'L';
layout?: 'Default' | 'Block';
children: ReactNode;
as: 'button' | 'a';
};
Expand Down Expand Up @@ -63,11 +64,14 @@ const isButton = (props: ButtonProps): props is HTMLButtonProps => props.as ===

export const Button: FC<ButtonProps> = (props) => {
const className = merge([
'justify-center',
'text-center',
'will-change-auto',
'text-white',
'rounded-lg',
'inline-flex flex-row items-center',
'transition-all ease-in-out',
props.layout === 'Block' ? 'w-full' : '',
colorMap[props.color],
sizeMap[props.size],
]);
Expand Down
6 changes: 6 additions & 0 deletions stories/button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ export default {
title: 'Components/Button',
component: Button,
argTypes: {
layout: {
options: ['Default', 'Block'],
control: { type: 'select' },
},
color: {
options: ['Slate', 'Violet', 'Gradient'],
control: { type: 'select' },
Expand Down Expand Up @@ -37,6 +41,7 @@ ButtonComponent.args = {
children: 'Button Label',
as: 'a',
href: '#',
layout: 'Default',
};

export const ButtonWithIconComponent: ComponentStory<typeof Button> = ({ children, ...args }) => (
Expand All @@ -54,4 +59,5 @@ ButtonWithIconComponent.args = {
children: 'Button Label',
as: 'a',
href: '#',
layout: 'Default',
};

0 comments on commit 8987844

Please sign in to comment.