-
-
Notifications
You must be signed in to change notification settings - Fork 149
/
Copy path6-Misc.stories.js
60 lines (54 loc) · 1.42 KB
/
6-Misc.stories.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import React from 'react';
import SelectSearch from '../src';
import '../style.css';
import { useEffect, useState } from "react";
import { colors } from "./data";
export default {
title: 'Misc',
};
export const StateOptions = () => {
const [options, setOptions] = useState([]);
useEffect(() => {
setOptions(colors);
}, []);
return (
<SelectSearch
defaultValue={colors[1].value}
options={options}
multiple
/>
);
};
export const NumericValues = () => (
<SelectSearch
defaultValue={0}
options={[
{ value: 1, name: 'Second' },
{ value: 0, name: 'First' },
{ value: 'third', name: 'Third' },
]}
/>
);
export const Form = () => (
<>
<div style={{ marginBottom: '16px' }}>
<SelectSearch
printOptions="on-focus"
multiple
placeholder="Select your items"
options={[
{ value: 'hamburger', name: 'Hamburger' },
{ value: 'fries', name: 'Fries' },
{ value: 'milkshake', name: 'Milkshake' },
]}
/>
</div>
<SelectSearch
options={[
{ value: 's', name: 'Small' },
{ value: 'm', name: 'Medium' },
{ value: 'l', name: 'Large' },
]}
/>
</>
);