imbric-theme 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- package/.dockerignore +14 -0
- package/.eslintignore +1 -0
- package/.prettierignore +1 -0
- package/.storybook/main.js +6 -2
- package/.storybook/preview.js +21 -0
- package/.vscode/settings.json +3 -0
- package/Dockerfile +17 -0
- package/README.md +2 -2
- package/atoms/AlertModal/AlertModal.js +69 -0
- package/atoms/AlertModal/AlertModal.module.css +3 -0
- package/atoms/AlertModal/AlertModal.stories.js +30 -0
- package/atoms/AlertModal/constants.js +4 -0
- package/atoms/AlertModal/index.js +3 -0
- package/atoms/Button/Button.js +17 -2
- package/atoms/Button/Button.module.css +25 -3
- package/atoms/Button/Button.stories.js +1 -1
- package/atoms/Button/__snapshots__/Button.stories.js.snap +8 -8
- package/atoms/Check/Check.js +6 -4
- package/atoms/Checkbox/Checkbox.js +77 -0
- package/atoms/Checkbox/Checkbox.module.css +60 -0
- package/atoms/Checkbox/Checkbox.stories.js +30 -0
- package/atoms/Checkbox/constants.js +1 -0
- package/atoms/Checkbox/index.js +3 -0
- package/atoms/Divider/Divider.js +5 -2
- package/atoms/Divider/Divider.module.css +20 -0
- package/atoms/Divider/Divider.stories.js +13 -2
- package/atoms/Divider/constants.js +3 -0
- package/atoms/Divider/index.js +1 -0
- package/atoms/Heading/Heading.js +1 -1
- package/atoms/Heading/Heading.module.css +4 -0
- package/atoms/Heading/Heading.stories.js +2 -2
- package/atoms/Heading/__snapshots__/Heading.stories.js.snap +16 -16
- package/atoms/Heading/constants.js +1 -1
- package/atoms/Icon/Icon.js +1 -1
- package/atoms/Icon/Icon.module.css +30 -0
- package/atoms/Icon/constants.js +750 -145
- package/atoms/Input/Input.js +195 -15
- package/atoms/Input/Input.module.css +62 -6
- package/atoms/Input/Input.stories.js +8 -2
- package/atoms/Input/__snapshots__/Input.stories.js.snap +5 -5
- package/atoms/Input/constants.js +1 -1
- package/atoms/Label/Label.js +31 -0
- package/atoms/Label/Label.module.css +42 -0
- package/atoms/Label/Label.stories.js +26 -0
- package/atoms/Label/constants.js +1 -0
- package/atoms/Label/index.js +3 -0
- package/atoms/LinkItem/LinkItem.js +38 -0
- package/atoms/{Link/Link.module.css → LinkItem/LinkItem.module.css} +6 -1
- package/atoms/{Link/Link.stories.js → LinkItem/LinkItem.stories.js} +5 -5
- package/atoms/LinkItem/index.js +3 -0
- package/atoms/Modal/Modal.js +27 -4
- package/atoms/Modal/Modal.module.css +63 -6
- package/atoms/Paragraph/Paragraph.module.css +4 -0
- package/atoms/Paragraph/Paragraph.stories.js +2 -2
- package/atoms/Paragraph/__snapshots__/Paragraph.stories.js.snap +16 -16
- package/atoms/Picture/Picture.js +9 -2
- package/atoms/Tab/Tab.js +41 -0
- package/atoms/Tab/Tab.module.css +17 -0
- package/atoms/Tab/Tab.stories.js +27 -0
- package/atoms/Tab/constants.js +1 -0
- package/atoms/Tab/index.js +3 -0
- package/atoms/Textarea/Textarea.js +106 -15
- package/atoms/Textarea/Textarea.module.css +31 -2
- package/atoms/Toggle/Toggle.js +56 -0
- package/atoms/Toggle/Toggle.module.css +41 -0
- package/atoms/Toggle/Toggle.stories.js +21 -0
- package/atoms/Toggle/constants.js +1 -0
- package/atoms/Toggle/index.js +3 -0
- package/helpers/storybook.js +2 -2
- package/hook/useAddColumn.js +40 -0
- package/hook/useStateDate.js +25 -0
- package/hook/useTable.js +54 -0
- package/index.js +41 -1
- package/jest.config.js +1 -1
- package/layout/DynamicTable/DynamicTable.js +372 -0
- package/layout/DynamicTable/DynamicTable.module.css +62 -0
- package/layout/DynamicTable/DynamicTable.stories.js +79 -0
- package/layout/DynamicTable/constants.js +323 -0
- package/layout/DynamicTable/index.js +3 -0
- package/layout/FlexColumnContent/FlexColumnContent.js +26 -0
- package/layout/FlexColumnContent/FlexColumnContent.module.css +5 -0
- package/layout/FlexColumnContent/FlexColumnContent.stories.js +28 -0
- package/layout/FlexColumnContent/constants.js +1 -0
- package/layout/FlexColumnContent/index.js +3 -0
- package/layout/Navbar/Navbar.js +247 -0
- package/layout/Navbar/Navbar.module.css +35 -0
- package/layout/Navbar/Navbar.stories.js +20 -0
- package/layout/Navbar/constants.js +35 -0
- package/layout/Navbar/index.js +2 -0
- package/layout/Sidebar/Sidebar.js +115 -0
- package/layout/Sidebar/Sidebar.module.css +387 -0
- package/layout/Sidebar/Sidebar.stories.js +28 -0
- package/layout/Sidebar/constants.js +228 -0
- package/layout/Sidebar/index.js +3 -0
- package/molecules/Accordion/Accordion.js +11 -11
- package/molecules/CardDefault/CardDefault.js +65 -0
- package/molecules/CardDefault/CardDefault.module.css +19 -0
- package/molecules/CardDefault/CardDefault.stories.js +23 -0
- package/molecules/CardDefault/constants.js +1 -0
- package/molecules/CardDefault/index.js +3 -0
- package/molecules/CardProductTypesBooking/CardProductTypesBooking.js +89 -0
- package/molecules/CardProductTypesBooking/CardProductTypesBooking.module.css +118 -0
- package/molecules/CardProductTypesBooking/CardProductTypesBooking.stories.js +25 -0
- package/molecules/CardProductTypesBooking/constants.js +1 -0
- package/molecules/CardProductTypesBooking/index.js +3 -0
- package/molecules/CardServiceDetail/CardServiceDetail.js +400 -0
- package/molecules/CardServiceDetail/CardServiceDetail.module.css +222 -0
- package/molecules/CardServiceDetail/CardServiceDetail.stories.js +23 -0
- package/molecules/CardServiceDetail/constants.js +1 -0
- package/molecules/CardServiceDetail/index.js +3 -0
- package/molecules/CardServices/CardServices.js +461 -0
- package/molecules/CardServices/CardServices.module.css +213 -0
- package/molecules/CardServices/CardServices.stories.js +41 -0
- package/molecules/CardServices/constants.js +5 -0
- package/molecules/CardServices/index.js +3 -0
- package/molecules/CardServicesFinalized/CardServicesFinalized.js +381 -0
- package/molecules/CardServicesFinalized/CardServicesFinalized.module.css +213 -0
- package/molecules/CardServicesFinalized/CardServicesFinalized.stories.js +23 -0
- package/molecules/CardServicesFinalized/constants.js +1 -0
- package/molecules/CardServicesFinalized/index.js +3 -0
- package/molecules/CheckList/CheckList.js +135 -0
- package/molecules/CheckList/CheckList.module.css +94 -0
- package/molecules/CheckList/CheckList.stories.js +25 -0
- package/molecules/CheckList/constants.js +23 -0
- package/molecules/CheckList/index.js +3 -0
- package/molecules/ColumnTable/ColumnTable.js +155 -0
- package/molecules/ColumnTable/ColumnTable.module.css +51 -0
- package/molecules/ColumnTable/ColumnTable.stories.js +26 -0
- package/molecules/ColumnTable/constants.js +117 -0
- package/molecules/ColumnTable/index.js +3 -0
- package/molecules/DatePicker/DatePicker.js +242 -0
- package/molecules/DatePicker/DatePicker.module.css +38 -0
- package/molecules/DatePicker/DatePicker.stories.js +23 -0
- package/molecules/DatePicker/constants.js +3 -0
- package/molecules/DatePicker/index.js +3 -0
- package/molecules/DatePickerTime/DatePickerTime.js +133 -0
- package/molecules/DatePickerTime/DatePickerTime.module.css +3 -0
- package/molecules/DatePickerTime/DatePickerTime.stories.js +18 -0
- package/molecules/DatePickerTime/constants.js +1 -0
- package/molecules/DatePickerTime/index.js +3 -0
- package/molecules/Dropdown/Dropdown.js +26 -23
- package/molecules/Dropdown/Dropdown.module.css +21 -3
- package/molecules/DynamicSelect/DynamicSelect.js +186 -0
- package/molecules/DynamicSelect/DynamicSelect.module.css +10 -0
- package/molecules/DynamicSelect/DynamicSelect.stories.js +32 -0
- package/molecules/DynamicSelect/constants.js +7 -0
- package/molecules/DynamicSelect/index.js +3 -0
- package/molecules/Error/Error.js +2 -2
- package/molecules/Error/Error.module.css +3 -2
- package/molecules/FooterTable/FooterTable.js +166 -0
- package/molecules/FooterTable/FooterTable.module.css +63 -0
- package/molecules/FooterTable/FooterTable.stories.js +23 -0
- package/molecules/FooterTable/constants.js +9 -0
- package/molecules/FooterTable/index.js +3 -0
- package/molecules/InputAutocomplete/InputAutocomplete.js +221 -0
- package/molecules/InputAutocomplete/InputAutocomplete.module.css +55 -0
- package/molecules/InputAutocomplete/InputAutocomplete.stories.js +23 -0
- package/molecules/InputAutocomplete/constants.js +1 -0
- package/molecules/InputAutocomplete/index.js +3 -0
- package/molecules/ItemMenu/ItemMenu.js +134 -0
- package/molecules/ItemMenu/ItemMenu.module.css +363 -0
- package/molecules/ItemMenu/ItemMenu.stories.js +42 -0
- package/molecules/ItemMenu/constants.js +36 -0
- package/molecules/ItemMenu/index.js +3 -0
- package/molecules/RowTable/RowTable.js +928 -0
- package/molecules/RowTable/RowTable.module.css +63 -0
- package/molecules/RowTable/RowTable.stories.js +26 -0
- package/molecules/RowTable/constants.js +798 -0
- package/molecules/RowTable/index.js +3 -0
- package/molecules/Tabs/Tabs.js +59 -0
- package/molecules/Tabs/Tabs.module.css +13 -0
- package/molecules/Tabs/Tabs.stories.js +34 -0
- package/molecules/Tabs/constants.js +34 -0
- package/molecules/Tabs/index.js +3 -0
- package/package.json +34 -17
- package/pages/Login/Login.js +102 -0
- package/pages/Login/Login.module.css +5 -0
- package/pages/Login/Login.stories.js +23 -0
- package/pages/Login/constants.js +1 -0
- package/pages/Login/index.js +3 -0
- package/pages/Login/validation/loginSchema.js +5 -0
- package/public/favicon.ico +0 -0
- package/public/static/google-maps.png +0 -0
- package/public/static/images/folders-folder.svg +26 -0
- package/public/static/images/permissions.svg +14 -0
- package/public/static/images/reports-results.svg +18 -0
- package/public/static/logo.svg +19 -0
- package/public/static/logologin.png +0 -0
- package/public/static/logologin.svg +16 -0
- package/public/static/logologintagos.svg +19 -0
- package/public/static/logotipo.svg +50 -0
- package/public/static/logotipoS.svg +26 -0
- package/public/static/taxisvalencia_logod.png +0 -0
- package/scripts/create-component.js +2 -1
- package/styles/GrupoMutua.css +391 -0
- package/styles/default.css +391 -0
- package/styles/globals.css +1514 -0
- package/styles/radiotaxiaragon.css +391 -0
- package/styles/spartan.css +391 -0
- package/styles/tagos.css +391 -0
- package/styles/taxisvalencia.css +391 -0
- package/styles/tokens.css +2 -1
- package/tokens/index.js +2 -1
- package/.eslintcache +0 -1
- package/atoms/Link/Link.js +0 -33
- package/atoms/Link/index.js +0 -3
- /package/atoms/{Link → LinkItem}/__snapshots__/Link.stories.js.snap +0 -0
- /package/atoms/{Link → LinkItem}/constants.js +0 -0
@@ -0,0 +1,221 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { useState } from "react";
|
3
|
+
import PropTypes from 'prop-types'
|
4
|
+
|
5
|
+
import styles from './InputAutocomplete.module.css'
|
6
|
+
import { options } from './constants'
|
7
|
+
import withStyles from '../../hocs/withStyles'
|
8
|
+
import { useRouter } from 'next/router'
|
9
|
+
|
10
|
+
import { BarLoader, ClipLoader } from 'react-spinners'
|
11
|
+
import Input from '../../atoms/Input'
|
12
|
+
import Picture from '../../atoms/Picture'
|
13
|
+
import Icon from '../../atoms/Icon'
|
14
|
+
import { Horizontal } from '../../layout/Spacer/components';
|
15
|
+
|
16
|
+
|
17
|
+
export const InputAutocomplete = ({
|
18
|
+
placeholderOnInput,
|
19
|
+
idOnInput,
|
20
|
+
suggestedAddresses,
|
21
|
+
handleOnInputChange,
|
22
|
+
handleOnFocus,
|
23
|
+
handleOnBlur,
|
24
|
+
handleOnSelect,
|
25
|
+
viewAutocomplete,
|
26
|
+
viewBarLoader,
|
27
|
+
viewIconList,
|
28
|
+
viewInputSecondary,
|
29
|
+
styleWidthInput,
|
30
|
+
value,
|
31
|
+
isViewIcon,
|
32
|
+
idIcon,
|
33
|
+
nameIcon,
|
34
|
+
sizeIcon,
|
35
|
+
colorIcon,
|
36
|
+
backgroundIcon,
|
37
|
+
getStyles
|
38
|
+
}) => {
|
39
|
+
|
40
|
+
// let [loading, setLoading] = useState(false);
|
41
|
+
// let [color, setColor] = useState("#ffffff");
|
42
|
+
|
43
|
+
const override = {
|
44
|
+
display: "block",
|
45
|
+
margin: "0 auto",
|
46
|
+
borderColor: "red",
|
47
|
+
width: "94%",
|
48
|
+
};
|
49
|
+
|
50
|
+
// const options = [
|
51
|
+
// { label: "Option 1", value: 1 },
|
52
|
+
// { label: "Option 2", value: 2 },
|
53
|
+
// { label: "Option 3", value: 3 }
|
54
|
+
// ];
|
55
|
+
|
56
|
+
// const Input = (props) => {
|
57
|
+
// const { autoComplete = props.autoComplete } = props.selectProps;
|
58
|
+
// return <components.Input {...props} autoComplete={autoComplete} />;
|
59
|
+
// };
|
60
|
+
|
61
|
+
|
62
|
+
// const handleOnInputChange = (string, results) => {
|
63
|
+
// console.log(string, results)
|
64
|
+
|
65
|
+
// }
|
66
|
+
|
67
|
+
// const loadOptions = (string, results) => {
|
68
|
+
// // inputValue: string,
|
69
|
+
// // callback: (options: ColourOption[]) => void
|
70
|
+
// }
|
71
|
+
|
72
|
+
// const handleOnInputChange = (string, results) => {
|
73
|
+
// console.log(string, results)
|
74
|
+
|
75
|
+
// }
|
76
|
+
|
77
|
+
const router = useRouter()
|
78
|
+
|
79
|
+
|
80
|
+
return <div className={getStyles('input-autocomplete')}>
|
81
|
+
|
82
|
+
{isViewIcon ?
|
83
|
+
|
84
|
+
<div className={getStyles('box-icon-input')}>
|
85
|
+
|
86
|
+
<Icon
|
87
|
+
id={idIcon}
|
88
|
+
name={nameIcon}
|
89
|
+
size={sizeIcon}
|
90
|
+
color={colorIcon}
|
91
|
+
background={backgroundIcon}
|
92
|
+
/>
|
93
|
+
|
94
|
+
<Horizontal size="xs" />
|
95
|
+
|
96
|
+
<Input
|
97
|
+
autoComplete={'off'}
|
98
|
+
id={idOnInput}
|
99
|
+
type='text'
|
100
|
+
name={idOnInput}
|
101
|
+
onChange={handleOnInputChange}
|
102
|
+
onFocus={handleOnFocus}
|
103
|
+
onBlur={handleOnBlur}
|
104
|
+
placeholder={placeholderOnInput}
|
105
|
+
isInputSecondary={viewInputSecondary}
|
106
|
+
value={value}
|
107
|
+
/>
|
108
|
+
|
109
|
+
</div>
|
110
|
+
|
111
|
+
:
|
112
|
+
|
113
|
+
<Input
|
114
|
+
autoComplete={'off'}
|
115
|
+
id={idOnInput}
|
116
|
+
type='text'
|
117
|
+
name={idOnInput}
|
118
|
+
onChange={handleOnInputChange}
|
119
|
+
onFocus={handleOnFocus}
|
120
|
+
onBlur={handleOnBlur}
|
121
|
+
placeholder={placeholderOnInput}
|
122
|
+
isInputSecondary={viewInputSecondary}
|
123
|
+
value={value}
|
124
|
+
/>}
|
125
|
+
|
126
|
+
{!viewBarLoader && suggestedAddresses.length !== 0 && viewAutocomplete ? (
|
127
|
+
<div className={getStyles('input-autocomplete-box-results')}>
|
128
|
+
<ul className={getStyles('input-autocomplete-ul')}>
|
129
|
+
{suggestedAddresses.map((itemAddresses, index) => (
|
130
|
+
<li id={'idLiItem' + index} key={index} className={getStyles('input-autocomplete-li')} onClick={handleOnSelect}>
|
131
|
+
{viewIconList ?
|
132
|
+
<div className={getStyles('input-autocomplete-li-icon')}>
|
133
|
+
<Picture
|
134
|
+
src={itemAddresses.iconURL ? itemAddresses.iconURL : router.basePath + "/static/google-maps.png"}
|
135
|
+
width={15}
|
136
|
+
height={15}
|
137
|
+
/>
|
138
|
+
</div>
|
139
|
+
:
|
140
|
+
null
|
141
|
+
|
142
|
+
}
|
143
|
+
{itemAddresses.name ? itemAddresses.name : itemAddresses.addressField}
|
144
|
+
</li>
|
145
|
+
))}
|
146
|
+
</ul>
|
147
|
+
</div>
|
148
|
+
)
|
149
|
+
:
|
150
|
+
viewAutocomplete ? (
|
151
|
+
<div className={getStyles('input-autocomplete-box-results')}>
|
152
|
+
<ul className={getStyles('input-autocomplete-ul')}>
|
153
|
+
|
154
|
+
<li className={getStyles('input-autocomplete-li')} onClick={handleOnSelect}>
|
155
|
+
<div className={getStyles('input-autocomplete-li-icon')}>
|
156
|
+
<Icon
|
157
|
+
name="clock"
|
158
|
+
size="xs"
|
159
|
+
/>
|
160
|
+
</div>
|
161
|
+
No hay resultados
|
162
|
+
</li>
|
163
|
+
|
164
|
+
</ul>
|
165
|
+
</div>
|
166
|
+
)
|
167
|
+
: null
|
168
|
+
}
|
169
|
+
|
170
|
+
|
171
|
+
<BarLoader color="#36d7b7" loading={viewBarLoader} cssOverride={override} size={150} />
|
172
|
+
|
173
|
+
|
174
|
+
</div>
|
175
|
+
}
|
176
|
+
|
177
|
+
InputAutocomplete.propTypes = {
|
178
|
+
getStyles: PropTypes.func.isRequired,
|
179
|
+
placeholderOnInput: PropTypes.string,
|
180
|
+
idOnInput: PropTypes.string,
|
181
|
+
suggestedAddresses: PropTypes.array,
|
182
|
+
handleOnInputChange: PropTypes.func,
|
183
|
+
handleOnFocus: PropTypes.func,
|
184
|
+
handleOnBlur: PropTypes.func,
|
185
|
+
handleOnSelect: PropTypes.func,
|
186
|
+
viewAutocomplete: PropTypes.bool,
|
187
|
+
viewBarLoader: PropTypes.bool,
|
188
|
+
viewIconList: PropTypes.bool,
|
189
|
+
viewInputSecondary: PropTypes.bool,
|
190
|
+
styleWidthInput: PropTypes.string,
|
191
|
+
isViewIcon: PropTypes.bool,
|
192
|
+
idIcon: PropTypes.string,
|
193
|
+
nameIcon: PropTypes.string,
|
194
|
+
sizeIcon: PropTypes.string,
|
195
|
+
colorIcon: PropTypes.string,
|
196
|
+
backgroundIcon: PropTypes.string,
|
197
|
+
}
|
198
|
+
|
199
|
+
InputAutocomplete.defaultProps = {
|
200
|
+
getStyles: () => { },
|
201
|
+
placeholderOnInput: '',
|
202
|
+
idOnInput: '',
|
203
|
+
suggestedAddresses: [],
|
204
|
+
handleOnInputChange: () => { },
|
205
|
+
handleOnFocus: () => { },
|
206
|
+
handleOnBlur: () => { },
|
207
|
+
handleOnSelect: () => { },
|
208
|
+
viewAutocomplete: false,
|
209
|
+
viewBarLoader: false,
|
210
|
+
viewIconList: true,
|
211
|
+
viewInputSecondary: false,
|
212
|
+
styleWidthInput: '260',
|
213
|
+
isViewIcon: false,
|
214
|
+
idIcon: 'Ejemplo',
|
215
|
+
nameIcon: 'user',
|
216
|
+
sizeIcon: 'md',
|
217
|
+
colorIcon: 'highlight',
|
218
|
+
backgroundIcon: 'base',
|
219
|
+
}
|
220
|
+
|
221
|
+
export default withStyles(styles)(InputAutocomplete)
|
@@ -0,0 +1,55 @@
|
|
1
|
+
.input-autocomplete {
|
2
|
+
width: 100%;
|
3
|
+
}
|
4
|
+
|
5
|
+
.input-autocomplete-box-results {
|
6
|
+
padding: 7px 0px;
|
7
|
+
border-radius: var(--border-radius-xs);
|
8
|
+
border: var(--border-width-thin) solid var(--color-brand-white-lilac);
|
9
|
+
background-color: var(--color-base-white);
|
10
|
+
max-height: 230px;
|
11
|
+
overflow-y: auto;
|
12
|
+
box-shadow: 0 0 0 1px var(--color-primary), 0 0 10px 0 var(--color-primary);
|
13
|
+
outline: none;
|
14
|
+
position: absolute;
|
15
|
+
z-index: 11111;
|
16
|
+
margin-top: 2px;
|
17
|
+
max-width: 520px;
|
18
|
+
min-width: 260px;
|
19
|
+
}
|
20
|
+
|
21
|
+
.input-autocomplete-ul {
|
22
|
+
display: block;
|
23
|
+
list-style-type: none;
|
24
|
+
margin-block-start: 0em;
|
25
|
+
margin-block-end: 0em;
|
26
|
+
margin-inline-start: 0px;
|
27
|
+
margin-inline-end: 0px;
|
28
|
+
padding-inline-start: 0px;
|
29
|
+
}
|
30
|
+
|
31
|
+
.input-autocomplete-li {
|
32
|
+
color: var(--color-font-base);
|
33
|
+
padding: 7px 9px;
|
34
|
+
font-size: var(--font-size-mini);
|
35
|
+
font-weight: var(--font-weight-light);
|
36
|
+
text-align: left;
|
37
|
+
border-bottom: var(--border-width-thin) solid var(--color-brand-white-lilac);
|
38
|
+
display: flex;
|
39
|
+
}
|
40
|
+
|
41
|
+
.input-autocomplete-li:hover {
|
42
|
+
background: rgba(0, 0, 0, 0.04);
|
43
|
+
cursor: pointer;
|
44
|
+
}
|
45
|
+
|
46
|
+
.input-autocomplete-li-icon {
|
47
|
+
width: 15px;
|
48
|
+
min-width: 15px;
|
49
|
+
max-width: 15px;
|
50
|
+
margin-right: 6px;
|
51
|
+
}
|
52
|
+
|
53
|
+
.box-icon-input {
|
54
|
+
display: flex;
|
55
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { InputAutocomplete, styles, options } from '.'
|
2
|
+
|
3
|
+
import {
|
4
|
+
getTemplate,
|
5
|
+
getListTemplate,
|
6
|
+
getOptionsArgTypes,
|
7
|
+
} from '../../helpers/storybook'
|
8
|
+
|
9
|
+
const Template = getTemplate(InputAutocomplete, styles)
|
10
|
+
const ListTemplate = getListTemplate(InputAutocomplete, styles)
|
11
|
+
|
12
|
+
export default {
|
13
|
+
title: 'Molecules/InputAutocomplete',
|
14
|
+
component: InputAutocomplete,
|
15
|
+
args: {},
|
16
|
+
argTypes: {
|
17
|
+
// types: getOptionsArgTypes(options.types),
|
18
|
+
},
|
19
|
+
}
|
20
|
+
|
21
|
+
export const Default = Template.bind({})
|
22
|
+
// export const List = ListTemplate.bind({})
|
23
|
+
// List.args = { items: options.types.map((type) => ({ type })) }
|
@@ -0,0 +1 @@
|
|
1
|
+
export const options = { types: [] }
|
@@ -0,0 +1,134 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import PropTypes from 'prop-types'
|
3
|
+
import Link from 'next/link'
|
4
|
+
|
5
|
+
import styles from './ItemMenu.module.css'
|
6
|
+
import { options } from './constants'
|
7
|
+
import withStyles from '../../hocs/withStyles'
|
8
|
+
|
9
|
+
import Icon from '../../atoms/Icon'
|
10
|
+
|
11
|
+
export const ItemMenu = ({ children, getStyles, size, icon, color, background, subMenu, itemSubmenu, itemHref, itemActive }) => {
|
12
|
+
|
13
|
+
//create initial menuCollapse state using useState hook
|
14
|
+
const [subMenuCollapse, setSubMenuCollapse] = useState(false)
|
15
|
+
|
16
|
+
//create a custom function that will change menucollapse state from false to true and true to false
|
17
|
+
const subMenuIconClick = () => {
|
18
|
+
//condition checking to change state from true to false and vice versa
|
19
|
+
subMenuCollapse ? setSubMenuCollapse(false) : setSubMenuCollapse(true);
|
20
|
+
};
|
21
|
+
|
22
|
+
|
23
|
+
if (!subMenu) {
|
24
|
+
return (
|
25
|
+
<>
|
26
|
+
<Link href={itemHref} passHref>
|
27
|
+
<li className={getStyles('pro-menu-item', { 'active': itemActive })}>
|
28
|
+
|
29
|
+
<div className={getStyles('pro-inner-item')}>
|
30
|
+
|
31
|
+
<span className={getStyles('pro-icon-wrapper')}>
|
32
|
+
|
33
|
+
<span className={getStyles('pro-icon')}>
|
34
|
+
|
35
|
+
<Icon
|
36
|
+
size={size}
|
37
|
+
name={icon}
|
38
|
+
color={itemActive ? 'primary' : color}
|
39
|
+
background={background}
|
40
|
+
onClick={function noRefCheck() { }}
|
41
|
+
/>
|
42
|
+
|
43
|
+
</span>
|
44
|
+
|
45
|
+
</span>
|
46
|
+
|
47
|
+
<span className={getStyles('pro-item-content', { 'color': color })}>{children}</span>
|
48
|
+
|
49
|
+
</div>
|
50
|
+
|
51
|
+
</li>
|
52
|
+
</Link>
|
53
|
+
</>
|
54
|
+
)
|
55
|
+
} else {
|
56
|
+
return (
|
57
|
+
<>
|
58
|
+
<li className={getStyles('pro-menu-item', 'pro-sub-menu', { 'open': subMenuCollapse }, { 'activesubtxt': itemActive })} title="Home" href="/">
|
59
|
+
|
60
|
+
<div className={getStyles('pro-inner-item')} onClick={subMenuIconClick}>
|
61
|
+
|
62
|
+
<span className={getStyles('pro-icon-wrapper')}>
|
63
|
+
|
64
|
+
<span className={getStyles('pro-icon')}>
|
65
|
+
|
66
|
+
<Icon
|
67
|
+
size={size}
|
68
|
+
name={icon}
|
69
|
+
color={itemActive ? 'primary' : color}
|
70
|
+
background={background}
|
71
|
+
onClick={function noRefCheck() { }}
|
72
|
+
/>
|
73
|
+
</span>
|
74
|
+
|
75
|
+
</span>
|
76
|
+
|
77
|
+
<span className={getStyles('pro-item-content', 'title', { 'color': color })}>{children}</span>
|
78
|
+
|
79
|
+
<span className={getStyles('pro-arrow-wrapper')}>
|
80
|
+
<span className={getStyles('pro-arrow')}></span>
|
81
|
+
</span>
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div className={getStyles('react-slidedown', 'pro-inner-list-item', { 'closed': !subMenuCollapse })}>
|
86
|
+
<div>
|
87
|
+
<ul>
|
88
|
+
|
89
|
+
{itemSubmenu.map((item, index) => (
|
90
|
+
item.view ?
|
91
|
+
<Link key={index} href={item.href} passHref>
|
92
|
+
<li className={getStyles('pro-menu-item', { 'activesub': item.active })}>
|
93
|
+
<div className={getStyles('pro-inner-item')} role="button">
|
94
|
+
<span className={getStyles('pro-item-content')}>{item.text}</span></div>
|
95
|
+
</li>
|
96
|
+
</Link>
|
97
|
+
: null
|
98
|
+
))}
|
99
|
+
</ul>
|
100
|
+
</div>
|
101
|
+
</div>
|
102
|
+
|
103
|
+
</li>
|
104
|
+
</>
|
105
|
+
)
|
106
|
+
}
|
107
|
+
|
108
|
+
|
109
|
+
}
|
110
|
+
|
111
|
+
ItemMenu.propTypes = {
|
112
|
+
children: PropTypes.node.isRequired,
|
113
|
+
getStyles: PropTypes.func.isRequired,
|
114
|
+
subMenu: PropTypes.bool.isRequired,
|
115
|
+
itemActive: PropTypes.bool,
|
116
|
+
icon: PropTypes.oneOf(options.icons),
|
117
|
+
size: PropTypes.oneOf(options.sizes),
|
118
|
+
color: PropTypes.oneOf(options.colors),
|
119
|
+
background: PropTypes.oneOf(options.backgrounds),
|
120
|
+
}
|
121
|
+
|
122
|
+
ItemMenu.defaultProps = {
|
123
|
+
subMenu: false,
|
124
|
+
itemActive: false,
|
125
|
+
icon: 'home',
|
126
|
+
size: 'lg',
|
127
|
+
color: 'highlight',
|
128
|
+
background: 'transparent',
|
129
|
+
itemHref: '/',
|
130
|
+
getStyles: () => { },
|
131
|
+
}
|
132
|
+
|
133
|
+
|
134
|
+
export default withStyles(styles)(ItemMenu)
|