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

Create a story: UnitInput component #34

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions ui/components/ui/unit-input/unit-input.component.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import React from 'react';
import type { Meta, StoryObj } from '@storybook/react';
import UnitInput from './unit-input.component';

const meta: Meta<typeof UnitInput> = {
title: 'Components/UnitInput',
component: UnitInput,
argTypes: {
className: {
control: 'text',
},
dataTestId: {
control: 'text',
},
children: {
control: 'text',
},
actionComponent: {
control: 'text',
},
error: {
control: 'boolean',
},
onChange: {
action: 'changed',
},
onBlur: {
action: 'blurred',
},
placeholder: {
control: 'text',
},
suffix: {
control: 'text',
},
hideSuffix: {
control: 'boolean',
},
value: {
control: 'text',
},
keyPressRegex: {
control: 'text',
},
isDisabled: {
control: 'boolean',
},
isFocusOnInput: {
control: 'boolean',
},
},
args: {
className: '',
dataTestId: 'unit-input',
children: '',
actionComponent: '',
error: false,
placeholder: '0',
suffix: 'ETH',
hideSuffix: false,
value: '',
keyPressRegex: /^\d*(\.|,)?\d*$/u,
isDisabled: false,
isFocusOnInput: false,
},
};

export default meta;
type Story = StoryObj<typeof UnitInput>;

export const Default: Story = {};

Default.storyName = 'Default';

export const WithChildren: Story = {
args: {
children: 'This is a child component',
},
};

export const WithError: Story = {
args: {
error: true,
},
};

export const Disabled: Story = {
args: {
isDisabled: true,
},
};

export const WithSuffixHidden: Story = {
args: {
hideSuffix: true,
},
};
Loading