-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(TextInput): use common Input element for structure
- Loading branch information
1 parent
e32463f
commit aa002ce
Showing
39 changed files
with
560 additions
and
210 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
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
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from 'react'; | ||
|
||
import markdown from './README.mdx'; | ||
|
||
import Footer from '.'; | ||
import Link from '../Link'; | ||
|
||
export default { | ||
title: 'Components/Footer', | ||
component: Footer, | ||
parameters: { | ||
componentSubtitle: 'Component', | ||
mdx: markdown, | ||
}, | ||
}; | ||
|
||
export const Regular = (args) => ( | ||
<Footer {...args}> | ||
<div className="wfp--footer__info"> | ||
<div className="wfp--footer__info__item"> | ||
<p className="wfp--footer__label">A label</p> | ||
<ul className="wfp--footer__list"> | ||
<li> | ||
<Link href="http://www.wfp.org">First Link</Link> | ||
</li> | ||
<li> | ||
<Link href="http://www.wfp.org">Second Link</Link> | ||
</li> | ||
</ul> | ||
</div> | ||
<div className="wfp--footer__info__item"> | ||
<p className="wfp--footer__label">Another label</p> | ||
<ul className="wfp--footer__list"> | ||
<li> | ||
<Link href="http://www.wfp.org">First Link</Link> | ||
</li> | ||
<li> | ||
<Link href="http://www.wfp.org">Second Link</Link> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</Footer> | ||
); | ||
|
||
Regular.args = {}; | ||
|
||
export const External = (args) => ( | ||
<Footer | ||
external | ||
metaContent="2019 © World Food Programme" | ||
secondary={ | ||
<div> | ||
Via C. G. Viola 68 Parco dei Medici | ||
<br /> | ||
00148 Rome, Italy | ||
</div> | ||
}> | ||
<div> | ||
The United Nations World Food Programme - saving lives in emergencies and | ||
changing lives for millions through sustainable development. WFP works in | ||
more than 80 countries around the world, feeding people caught in conflict | ||
and disasters, and laying the foundations for a better future. | ||
<br /> | ||
<Link href="http://www.wfp.org">Custom Links</Link> | ||
</div> | ||
</Footer> | ||
); |
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
58 changes: 22 additions & 36 deletions
58
src/components/NumberInput/NumberInput.stories.js
100755 → 100644
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,41 +1,27 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import markdown from './README.mdx'; | ||
import { action } from '@storybook/addon-actions'; | ||
|
||
import { withKnobs, boolean, number, text } from '@storybook/addon-knobs'; | ||
import NumberInput from '.'; | ||
import NumberInputSkeleton from './NumberInput.Skeleton'; | ||
|
||
const props = () => ({ | ||
className: 'some-class', | ||
id: 'tj-input', | ||
addonBefore: text('addonBefore', '€'), | ||
addonAfter: text('addonAfter', '$'), | ||
formItemClassName: text( | ||
'Form item className (formItemClassName)', | ||
'some-form-item-class' | ||
), | ||
labelText: text('Label text (labelText)', 'Number Input label'), | ||
hideControls: boolean('hide controls (hideControls)', false), | ||
hideLabel: boolean('No label (hideLabel)', false), | ||
min: number('Minimum value (min)', 0), | ||
max: number('Maximum value (max)', 100), | ||
value: number('Value (value)', 50), | ||
step: number('Step of up/down arrow (step)', 10), | ||
disabled: boolean('Disabled (disabled)', false), | ||
invalid: boolean('Show form validation UI (invalid)', false), | ||
invalidText: text( | ||
'Form validation UI content (invalidText)', | ||
'Number is not valid' | ||
), | ||
helperText: text('Helper text (helperText)', 'Optional helper text.'), | ||
light: boolean('Light variant (light)', false), | ||
onChange: action('onChange'), | ||
onClick: action('onClick'), | ||
allowEmpty: boolean('Allow empty value (allowEmpty)', false), | ||
}); | ||
export default { | ||
title: 'Components/NumberInput', | ||
component: NumberInput, | ||
parameters: { | ||
componentSubtitle: 'Component', | ||
mdx: markdown, | ||
}, | ||
}; | ||
|
||
export const Regular = (args) => <NumberInput {...args} />; | ||
|
||
const description = ` | ||
You can customize the content by using \`BannerNavigation\`. | ||
`; | ||
|
||
storiesOf('Components|NumberInput', module) | ||
.addDecorator(withKnobs) | ||
.add('Default', () => <NumberInput {...props()} />) | ||
.add('skeleton', () => <NumberInputSkeleton />); | ||
Regular.story = { | ||
parameters: { | ||
docs: { | ||
storyDescription: description, | ||
}, | ||
}, | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { action } from '@storybook/addon-actions'; | ||
|
||
import { withKnobs, boolean, number, text } from '@storybook/addon-knobs'; | ||
import NumberInput from '.'; | ||
import NumberInputSkeleton from './NumberInput.Skeleton'; | ||
|
||
const props = () => ({ | ||
className: 'some-class', | ||
id: 'tj-input', | ||
addonBefore: text('addonBefore', '€'), | ||
addonAfter: text('addonAfter', '$'), | ||
formItemClassName: text( | ||
'Form item className (formItemClassName)', | ||
'some-form-item-class' | ||
), | ||
labelText: text('Label text (labelText)', 'Number Input label'), | ||
hideControls: boolean('hide controls (hideControls)', false), | ||
hideLabel: boolean('No label (hideLabel)', false), | ||
min: number('Minimum value (min)', 0), | ||
max: number('Maximum value (max)', 100), | ||
value: number('Value (value)', 50), | ||
step: number('Step of up/down arrow (step)', 10), | ||
disabled: boolean('Disabled (disabled)', false), | ||
invalid: boolean('Show form validation UI (invalid)', false), | ||
invalidText: text( | ||
'Form validation UI content (invalidText)', | ||
'Number is not valid' | ||
), | ||
helperText: text('Helper text (helperText)', 'Optional helper text.'), | ||
light: boolean('Light variant (light)', false), | ||
onChange: action('onChange'), | ||
onClick: action('onClick'), | ||
allowEmpty: boolean('Allow empty value (allowEmpty)', false), | ||
}); | ||
|
||
storiesOf('Components|NumberInput', module) | ||
.addDecorator(withKnobs) | ||
.add('Default', () => <NumberInput {...props()} />) | ||
.add('skeleton', () => <NumberInputSkeleton />); |
4 changes: 3 additions & 1 deletion
4
src/components/NumberInput/README.md → src/components/NumberInput/README.mdx
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,10 +1,12 @@ | ||
**NumberInput** are used to let the user enter a number. They include built-in validation to reject non-numerical entries. They provide stepper arrows to let the user increase and decrease the value using their mouse or by simply tapping with a fingertip. | ||
|
||
<!-- | ||
### Usage with react | ||
```js | ||
import { NumberInput } from '@wfp/ui'; | ||
``` | ||
|
||
```js | ||
<NumberInput name="inputname" /> | ||
``` | ||
``` | ||
--> |
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
Oops, something went wrong.