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

design(TextInput): final design review for TextInput component #279

Merged
merged 4 commits into from
Jan 25, 2024
Merged
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
62 changes: 41 additions & 21 deletions src/components/TextInput/TextInput.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react';
import { Button, Icon, TextInput } from '~/src/index';

const meta: Meta<typeof TextInput> = {
title: 'Components (Draft)/Text inputs',
title: 'Components (Verified)/Text inputs',
component: TextInput,
argTypes: {
isFullWidth: { control: 'boolean' },
Expand All @@ -14,76 +14,92 @@ export default meta;

type Story = StoryObj<typeof meta>;

export const Default: Story = {
export const Enabled: Story = {
args: {
name: 'Default',
id: 'Default',
value: 'Default',
name: 'Enabled',
id: 'Enabled',
value: 'Enabled',
type: 'text'
}
};

export const Hover: Story = {
args: {
...Default.args,
...Enabled.args,
name: 'Hover',
id: 'Hover',
value: 'Hover'
},
render: _arguments => <TextInput {..._arguments} className='hover' />
};

export const Focus: Story = {
args: {
...Default.args,
...Enabled.args,
name: 'Focus',
id: 'Focus',
value: 'Focus'
},
render: _arguments => <TextInput {..._arguments} className='focus' />
};

export const Disabled: Story = {
args: {
...Default.args,
...Enabled.args,
value: 'Disabled',
name: 'Disabled',
id: 'Disabled',
disabled: true
}
};

export const Success: Story = {
args: {
...Default.args,
...Enabled.args,
value: 'Success',
name: 'Success',
id: 'Success',
status: 'success'
}
};

export const Warning: Story = {
args: {
...Default.args,
...Enabled.args,
value: 'Warning',
name: 'Warning',
id: 'Warning',
status: 'warning'
}
};

export const Error: Story = {
args: {
...Default.args,
...Enabled.args,
value: 'Error',
name: 'Error',
id: 'Error',
status: 'error'
}
};

export const FullWidth: Story = {
name: 'Text input (full width)',
name: 'Full width',
args: {
...Default.args,
...Enabled.args,
value: 'Input text',
name: 'fullWidth',
id: 'fullWidth',
isFullWidth: true
}
};

export const WithButton: Story = {
name: 'Text input (with button)',
name: 'With button',
args: {
...Default.args,
...Enabled.args,
name: 'withButton',
id: 'withButton',
value: ''
},
render: _arguments => (
Expand All @@ -99,11 +115,13 @@ export const WithButton: Story = {
};

export const WithButtonInsideText: Story = {
name: 'Button inside text input',
name: 'Button inside',
args: {
...Default.args,
...Enabled.args,
value:
"This is some really long text to make sure that the button doesn't overlap the content in such a way that this input becomes unusable."
"This is some really long text to make sure that the button doesn't overlap the content in such a way that this input becomes unusable.",
name: 'ButtonInside',
id: 'ButtonInside'
},
render: _arguments => (
<div className='m-btn-inside-input'>
Expand All @@ -116,11 +134,13 @@ export const WithButtonInsideText: Story = {
};

export const WithButtonInsideButton: Story = {
name: 'Button inside text input with another button',
name: 'Button inside (with button)',
args: {
...Default.args,
...Enabled.args,
value:
"This is some really long text to make sure that the button doesn't overlap the content in such a way that this input becomes unusable."
"This is some really long text to make sure that the button doesn't overlap the content in such a way that this input becomes unusable.",
name: 'ButtonInsideButton',
id: 'ButtonInsideButton'
},
render: _arguments => (
<div className='o-form__input-w-btn'>
Expand Down