feat(typescript): Add typescript support for UI components library (#43541)
* Add TS configs and improve dir structure * Add TS configs and improve dir structure * Fix components exports from index * chore: prettier * Add tsconfig and then fix the linter warnings * Add @babel/preset-typescript * Fix eslint rule and update btn component to fix storybook * Fix TS and Jest configs Converted all remaining files to TS as well * Remove TS ignored rules and fixed some TS & jest stuff * Revert to old directory structure * Use absolute versions in package.json * enable ts strict to infer types Co-authored-by: Hamza Waleed <hamza.waleed@arbisoft.com>
This commit is contained in:
39
tools/ui-components/src/button.stories.tsx
Normal file
39
tools/ui-components/src/button.stories.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
import { Story } from '@storybook/react';
|
||||
import React from 'react';
|
||||
import { Button } from './button';
|
||||
import { ButtonProps } from './button.types';
|
||||
|
||||
const story = {
|
||||
title: 'Example/Button',
|
||||
component: Button,
|
||||
argTypes: {
|
||||
backgroundColor: { control: 'color' }
|
||||
}
|
||||
};
|
||||
|
||||
const Template: Story<ButtonProps> = args => <Button {...args} />;
|
||||
|
||||
export const Primary = Template.bind({});
|
||||
Primary.args = {
|
||||
primary: true,
|
||||
label: 'Button'
|
||||
};
|
||||
|
||||
export const Secondary = Template.bind({});
|
||||
Secondary.args = {
|
||||
label: 'Button'
|
||||
};
|
||||
|
||||
export const Large = Template.bind({});
|
||||
Large.args = {
|
||||
size: 'large',
|
||||
label: 'Button'
|
||||
};
|
||||
|
||||
export const Small = Template.bind({});
|
||||
Small.args = {
|
||||
size: 'small',
|
||||
label: 'Button'
|
||||
};
|
||||
|
||||
export default story;
|
Reference in New Issue
Block a user