Skip to content

Commit

Permalink
feat: update playground
Browse files Browse the repository at this point in the history
  • Loading branch information
kostasdano committed Nov 2, 2023
1 parent eb896f9 commit 2fd14d9
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/components/Button/Button.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Stack from '../storyUtils/Stack';
import LinkTo from '@storybook/addon-links/react';

import { FIGMA_URL } from '../../utils/common';
import LoadingButtonShowcase from '../storyUtils/LoadingButtonShowcase';
import { LoadingButtonShowcase, ButtonShowcase } from '../storyUtils/ButtonShowcases';
import Overview from '../../storybook/Overview';
import { getIconSelectorKnob } from '../../utils/stories';

Expand Down Expand Up @@ -354,13 +354,17 @@ Can be only combined with a right icon, not with a left icon at the same time.
<Preview>
<Story name="Playground" parameters={{ decorators: [withKnobs] }}>
<Stack isVertical>
<Button
isBlock
<ButtonShowcase
buttonLabel={text('Button Label', 'Label')}
type={select(
'type',
['primary', 'secondary', 'tertiary', 'danger', 'inverted', 'invertedAlt'],
'primary'
)}
hasAvatar={boolean('hasAvatar', false)}
avatar={{
label: text('Avatar Label'),
}}
size={select('size', ['compact', 'normal'], 'normal')}
iconLeftName={getIconSelectorKnob('iconLeftName')}
iconRightName={getIconSelectorKnob('iconRightName')}
Expand All @@ -369,7 +373,7 @@ Can be only combined with a right icon, not with a left icon at the same time.
isBlock={boolean('isBlock', false)}
>
Hello world
</Button>
</ButtonShowcase>
</Stack>
</Story>
</Preview>
35 changes: 35 additions & 0 deletions src/components/storyUtils/ButtonShowcases/ButtonShowcase.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from 'react';

import Button, { ButtonProps } from '../../Button';

const ButtonShowcase: React.FCC<ButtonProps & { hasAvatar: boolean; buttonLabel: string }> = ({
isBlock,
type,
hasAvatar,
avatar,
size,
iconLeftName,
iconRightName,
isLoading,
isDisabled,
buttonLabel,
}) => {
const avatarProps = hasAvatar ? { avatar } : {};

return (
<Button
isBlock={isBlock}
type={type}
size={size}
iconLeftName={iconLeftName}
iconRightName={iconRightName}
isLoading={isLoading}
isDisabled={isDisabled}
{...avatarProps}
>
{buttonLabel}
</Button>
);
};

export default ButtonShowcase;
2 changes: 2 additions & 0 deletions src/components/storyUtils/ButtonShowcases/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as LoadingButtonShowcase } from './LoadingButtonShowcase';
export { default as ButtonShowcase } from './ButtonShowcase';
1 change: 0 additions & 1 deletion src/components/storyUtils/LoadingButtonShowcase/index.ts

This file was deleted.

0 comments on commit 2fd14d9

Please sign in to comment.