Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Create a story for IconButton component #26

Closed
wants to merge 7 commits into from
Closed
44 changes: 44 additions & 0 deletions ui/components/ui/icon-button/icon-button.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React from 'react';
import { Meta, Story } from '@storybook/react';
import IconButton from './icon-button';
import { TextVariant } from '../../../helpers/constants/design-system';
import Tooltip from '../tooltip/tooltip';

export default {
title: 'Components/UI/IconButton',
component: IconButton,
argTypes: {
onClick: { action: 'clicked' },
Icon: { control: 'object' },
disabled: { control: 'boolean' },
label: { control: 'text' },
tooltipRender: { control: 'function' },
className: { control: 'text' },
'data-testid': { control: 'text' },
},
} as Meta<typeof IconButton>;

const Template: Story<typeof IconButton> = (args) => <IconButton {...args} />;

export const Default = Template.bind({});
Default.args = {
onClick: () => alert('Button clicked!'),
Icon: <div>Icon</div>,
disabled: false,
label: 'Button Label',
tooltipRender: (inner) => <Tooltip title="Tooltip">{inner}</Tooltip>,
className: '',
'data-testid': 'icon-button',
};

export const Disabled = Template.bind({});
Disabled.args = {
...Default.args,
disabled: true,
};

export const WithLongLabel = Template.bind({});
WithLongLabel.args = {
...Default.args,
label: 'This is a very long label that should trigger the tooltip',
};
Loading