This repository has been archived by the owner on Aug 21, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101 from helpscout/input/fix-autocomplete-styles
Input: Fix webkit autocomplete styles
- Loading branch information
Showing
3 changed files
with
98 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,89 @@ | ||
import React from 'react' | ||
import { storiesOf } from '@storybook/react' | ||
import { Input } from '../src/index.js' | ||
|
||
storiesOf('Input', module) | ||
.add('default', () => <Input />) | ||
.add('helptext', () => <Input helpText='This text appears below the input' />) | ||
.add('hinttext', () => <Input hintText='This text appears above the input' />) | ||
.add('multiline', () => <Input multiline placeholder='This is a textarea!' autoFocus />) | ||
.add('multiline + resizable', () => <Input multiline={3} resizable autoFocus placeholder='This is a resizable textarea!' />) | ||
.add('label', () => <Input label='Labelled' autoFocus />) | ||
.add('placeholder', () => <Input placeholder='Hello' autoFocus />) | ||
.add('prefix + suffix', () => <Input prefix='$' suffix='.00' autoFocus />) | ||
.add('seamless', () => <Input seamless autoFocus />) | ||
.add('disabled', () => <Input disabled autoFocus />) | ||
.add('readonly', () => <Input readOnly autoFocus value={`I can't turn left`} />) | ||
.add('states', () => ( | ||
<div> | ||
<Input state='error' autoFocus /><br /> | ||
<Input state='success' helpText="You're Awesome!" hintText="You're awesome!" autoFocus /><br /> | ||
<Input state='warning' autoFocus /> | ||
</div> | ||
)) | ||
.add('sizes', () => ( | ||
<div> | ||
<Input autoFocus placeholder='Regular' /><br /> | ||
<Input size='sm' autoFocus placeholder='Small' /> | ||
</div> | ||
)) | ||
import { Button, Input } from '../src/index.js' | ||
|
||
const stories = storiesOf('Input', module) | ||
|
||
stories.add('default', () => ( | ||
<Input /> | ||
)) | ||
|
||
stories.add('autocomplete', () => ( | ||
<div style={{width: 300}}> | ||
<form autocomplete='on' action='/'> | ||
<Input | ||
autoFocus | ||
label='First name' | ||
name='fname' | ||
placeholder='Ron' | ||
type='text' | ||
/> | ||
<br /> | ||
<Button submit size='sm'>Submit</Button> | ||
</form> | ||
</div> | ||
)) | ||
|
||
stories.add('helpText', () => ( | ||
<Input helpText='This text appears below the input' /> | ||
)) | ||
|
||
stories.add('hintText', () => ( | ||
<Input hintText='This text appears above the input' /> | ||
)) | ||
|
||
stories.add('multiline', () => ( | ||
<Input | ||
multiline | ||
autoFocus | ||
placeholder='This is a textarea!' | ||
/> | ||
)) | ||
|
||
stories.add('multiline + resizable', () => ( | ||
<Input | ||
multiline={3} | ||
resizable | ||
autoFocus | ||
placeholder='This is a resizable textarea!' | ||
/> | ||
)) | ||
|
||
stories.add('label', () => ( | ||
<Input label='Labelled' autoFocus /> | ||
)) | ||
|
||
stories.add('placeholder', () => ( | ||
<Input placeholder='Hello' autoFocus /> | ||
)) | ||
|
||
stories.add('prefix + suffix', () => ( | ||
<Input prefix='$' suffix='.00' autoFocus /> | ||
)) | ||
|
||
stories.add('seamless', () => ( | ||
<Input seamless autoFocus /> | ||
)) | ||
|
||
stories.add('disabled', () => ( | ||
<Input disabled autoFocus /> | ||
)) | ||
|
||
stories.add('readonly', () => ( | ||
<Input readOnly autoFocus value={`I can't turn left`} /> | ||
)) | ||
|
||
stories.add('states', () => ( | ||
<div> | ||
<Input state='error' autoFocus /><br /> | ||
<Input state='success' helpText="You're Awesome!" hintText="You're awesome!" autoFocus /><br /> | ||
<Input state='warning' autoFocus /> | ||
</div> | ||
)) | ||
|
||
stories.add('sizes', () => ( | ||
<div> | ||
<Input autoFocus placeholder='Regular' /><br /> | ||
<Input size='sm' autoFocus placeholder='Small' /> | ||
</div> | ||
)) |