11import React , { useState } from "react" ;
22import { DropdownSearch } from "./dropdown-search" ;
3+ import { withKnobs , text , boolean } from "@storybook/addon-knobs" ;
34
4- export default { title : "Dropdown Search" } ;
5-
6- const title = "Judet" ;
5+ export default {
6+ title : "Dropdown Search" ,
7+ decorators : [ withKnobs ]
8+ } ;
79
810const options = [
911 { value : 1 , label : "Alba" } ,
@@ -15,57 +17,23 @@ const options = [
1517 { value : 7 , label : "Constanta" }
1618] ;
1719
18- export const DropdownSearchClosed = ( ) => {
19- return (
20- < DropdownSearch title = { "Judet" } options = { options } onSelect = { ( ) => { } } />
21- ) ;
22- } ;
20+ export const dropdownSearch = ( ) => {
21+ const showSearchInput = boolean ( "Show Search Input" , false ) ;
2322
24- export const DropdownSearchAlwaysOpen = ( ) => {
2523 return (
2624 < DropdownSearch
27- title = { title }
28- options = { options }
29- onSelect = { ( ) => { } }
30- isAlwaysOpen = { true }
31- />
32- ) ;
33- } ;
34-
35- export const DropdownSearchWithAlert = ( ) => {
36- return (
37- < DropdownSearch
38- title = { title }
3925 options = { options }
26+ title = { text ( "Title" , "Județ" ) }
27+ isAlwaysOpen = { boolean ( "Always Open" , false ) }
28+ showSearchInput = { showSearchInput }
29+ searchPlaceholder = { showSearchInput && text ( "Search Placeholder" , "Type to search in the list below" ) }
4030 onSelect = { ( selected ) => {
4131 alert ( JSON . stringify ( selected ) ) ;
4232 } }
4333 />
4434 ) ;
4535} ;
4636
47- export const DropdownWithSearchPlaceholder = ( ) => {
48- return (
49- < DropdownSearch
50- title = { title }
51- options = { options }
52- onSelect = { ( ) => { } }
53- searchPlaceholder = { "Type to search in the list below" }
54- />
55- ) ;
56- } ;
57-
58- export const DropdownWithoutSearchInput = ( ) => {
59- return (
60- < DropdownSearch
61- title = { title }
62- options = { options }
63- onSelect = { ( ) => { } }
64- showSearchInput = { false }
65- />
66- ) ;
67- } ;
68-
6937const countiesWithCities = {
7038 Alba : [ "Somewhere in Alba" , "Somewhere else in Alba" ] ,
7139 Prahova : [ "Somewhere in Prahova" , "Somewhere else in Prahova" ] ,
0 commit comments