Skip to content

Commit

Permalink
fix(core-components-money-input): fix demo
Browse files Browse the repository at this point in the history
  • Loading branch information
stepancar committed Jun 16, 2020
1 parent 1ea92b7 commit 2b22f2d
Showing 1 changed file with 29 additions and 23 deletions.
52 changes: 29 additions & 23 deletions packages/money-input/src/Component.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,38 @@ import { MoneyInput } from '@alfalab/core-components-money-input';

Компонент текстового поля для ввода денежных значений

<div style={{ width: '240px' }}>
<MoneyInput />

<Story name='Песочница'>
<MoneyInput
value={number('value', 123456)}
currency={text('currency', 'RUR')}
minority={number('minority', 100)}
bold={boolean('bold', true)}
block={boolean('block', false)}
size={select('size', ['s', 'm', 'l'], 's')}
disabled={boolean('disabled', false)}
placeholder={text('placeholder', '')}
label={text('label', '')}
hint={text('hint', '')}
error={text('error', '')}
leftAddons={boolean('leftAddons', false) && <Icon />}
bottomAddons={boolean('bottomAddons', false) && <span>bottom text</span>}
onChange={action('change')}
/>
</Story>
</div>
<Story name='Песочница'>
<MoneyInput
value={number('value', 0)}
currency={text('currency', 'RUR')}
minority={number('minority', 100)}
bold={boolean('bold', true)}
block={boolean('block', false)}
size={select('size', ['s', 'm', 'l'], 's')}
disabled={boolean('disabled', false)}
placeholder={text('placeholder', '')}
label={text('label', '')}
hint={text('hint', '')}
error={text('error', '')}
leftAddons={boolean('leftAddons', false) && <Icon />}
bottomAddons={boolean('bottomAddons', false) && <span>bottom text</span>}
onChange={action('change')}
/>
</Story>

<Props of={MoneyInput} />

Пример использования controlled компонента
### Uncontrolled-way

Можно ничего не передавать в компонент и реагировать на 'onChange'

<Preview>
<MoneyInput />
</Preview>

### Controlled-way

Компонент может быть использован как controlled с помощью `onChange` и `selected`:

<Preview>
{React.createElement(() => {
Expand Down

0 comments on commit 2b22f2d

Please sign in to comment.