Skip to content

Commit

Permalink
feat(experimental): add Button WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
artur-miglio-free-now committed Aug 7, 2024
1 parent 9e28c4f commit eb23f77
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/components/experimental/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';
import styled, { ThemeProvider } from 'styled-components';
import { Button as BaseButton } from '../../Button/Button';
import { theme as experimentalTheme, theme } from '../../../essentials/experimental/theme';
import { get } from '../../../utils/experimental/themeGet';

const ButtonStyled = styled(BaseButton).attrs({ theme })`
border-radius: ${get('radii.3')};
padding: ${get('space.6')} ${get('space.4')};
// TODO: HOVER
// TODO: SECONDARY VARIANT
`;

function Button() {
return (
<ThemeProvider theme={experimentalTheme}>
<ButtonStyled />
</ThemeProvider>
);
}

export default Button;
export { Button };
90 changes: 90 additions & 0 deletions src/components/experimental/Button/docs/Button.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import { StoryObj, Meta } from '@storybook/react';
import React from 'react';
import { Button } from '../Button';
import TrashIcon from '../../../../icons/actions/TrashIcon';

const meta: Meta = {
title: 'Experimental/Components/Button',
component: Button,
args: {
children: 'Button title'
},
argTypes: {
children: {
description: 'Button caption'
},
variant: {
control: 'radio',
options: ['primary', 'secondary', 'danger']
},
size: {
control: 'radio',
options: ['small', 'medium']
},
as: {
description: 'html tag to use',
control: 'text',
table: {
defaultValue: {
summary: 'button'
}
}
},
ref: {
table: {
disable: true
}
},
theme: {
table: {
disable: true
}
},
forwardedAs: {
table: {
disable: true
}
}
}
};

export default meta;

type Story = StoryObj<typeof Button>;

export const Default: Story = {};

export const Secondary: Story = {
args: {
variant: 'secondary'
}
};

export const Danger: Story = {
args: {
variant: 'danger'
}
};

export const Disabled: Story = {
args: {
disabled: true
}
};

export const Small: Story = {
args: {
size: 'small'
}
};

export const WithIcon: Story = {
args: {
children: (
<>
<TrashIcon size={20} /> Remove
</>
),
variant: 'danger'
}
};

0 comments on commit eb23f77

Please sign in to comment.