anima-ds-nucleus 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/anima-ds-nucleus.css +1 -1
- package/dist/anima-ds.cjs.js +124 -57
- package/dist/anima-ds.esm.js +6591 -5067
- package/package.json +10 -2
- package/src/assets/nucleus-logo.svg +3 -0
- package/src/components/Atoms/LogoHexa/LogoHexa.jsx +34 -0
- package/src/components/Atoms/LogoHexa/LogoHexa.stories.jsx +36 -0
- package/src/components/Atoms/Typography/Typography.jsx +4 -0
- package/src/components/Atoms/Typography/Typography.stories.jsx +37 -1
- package/src/components/DataDisplay/Card/Card.jsx +117 -24
- package/src/components/DataDisplay/Card/Card.stories.jsx +119 -35
- package/src/components/DataDisplay/Card/CardError.jsx +142 -0
- package/src/components/DataDisplay/Card/CardSkeleton.jsx +96 -0
- package/src/components/DataDisplay/Card/CardTituloCorto.jsx +62 -0
- package/src/components/DataDisplay/Card/CardTituloCortoMasEstado.jsx +80 -0
- package/src/components/DataDisplay/Card/CardTituloLargo.jsx +62 -0
- package/src/components/DataDisplay/Card/CardTituloLargoMasEstado.jsx +77 -0
- package/src/components/DataDisplay/Card/CardVacia.jsx +111 -0
- package/src/components/Layout/Header/HeaderConBuscador.stories.jsx +8 -0
- package/src/components/Layout/Header/HeaderCore.jsx +314 -85
- package/src/components/Layout/Header/HeaderCore.stories.jsx +25 -21
- package/src/components/Layout/Header/HeaderGeneral.jsx +92 -0
- package/src/components/Layout/Header/HeaderGeneral.stories.jsx +64 -0
- package/src/components/Layout/Header/HeaderPoint.jsx +120 -0
- package/src/components/Layout/Header/HeaderPoint.stories.jsx +110 -0
- package/src/components/Layout/NavPoint/NavPoint.jsx +64 -0
- package/src/components/Layout/NavPoint/NavPoint.stories.jsx +52 -0
- package/src/components/Layout/Sidebar/SidebarCore.jsx +524 -91
- package/src/components/Layout/Sidebar/SidebarCore.stories.jsx +76 -1
- package/src/components/Layout/Sidebar/SidebarPoint.jsx +264 -59
- package/src/components/Layout/Sidebar/SidebarPoint.stories.jsx +69 -0
- package/src/index.js +12 -3
- package/src/style.css +25 -0
- package/src/components/Layout/Header/Header.jsx +0 -50
- package/src/components/Layout/Header/Header.stories.jsx +0 -36
- package/src/components/Layout/Sidebar/Sidebar.jsx +0 -230
- package/src/components/Layout/Sidebar/Sidebar.stories.jsx +0 -90
|
@@ -1,113 +1,342 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useState } from 'react';
|
|
2
2
|
import { Icon } from '../../Atoms/Icon/Icon';
|
|
3
|
+
import { Avatar } from '../../Atoms/Avatar/Avatar';
|
|
4
|
+
import { Typography } from '../../Atoms/Typography/Typography';
|
|
3
5
|
|
|
4
6
|
export const HeaderCore = ({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
searchPlaceholder = 'Buscar empleados, reportes, configuraciones...',
|
|
8
|
+
userName,
|
|
9
|
+
userAvatar,
|
|
10
|
+
notificationCount = 0,
|
|
11
|
+
onSearch,
|
|
12
|
+
onNotificationClick,
|
|
13
|
+
onUserClick,
|
|
10
14
|
className = '',
|
|
11
15
|
...props
|
|
12
16
|
}) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
const [searchValue, setSearchValue] = useState('');
|
|
18
|
+
|
|
19
|
+
const handleSearchChange = (e) => {
|
|
20
|
+
const value = e.target.value;
|
|
21
|
+
setSearchValue(value);
|
|
22
|
+
if (onSearch) {
|
|
23
|
+
onSearch(value);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
20
26
|
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
const handleSearchSubmit = (e) => {
|
|
28
|
+
e.preventDefault();
|
|
29
|
+
if (onSearch) {
|
|
30
|
+
onSearch(searchValue);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
23
33
|
|
|
24
34
|
return (
|
|
25
35
|
<header
|
|
26
36
|
className={`bg-white border-b border-gray-200 ${className}`}
|
|
27
37
|
{...props}
|
|
28
38
|
>
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
<style>{`
|
|
40
|
+
.header-search-input {
|
|
41
|
+
border-color: #9ca3af;
|
|
42
|
+
}
|
|
43
|
+
.header-search-input::placeholder {
|
|
44
|
+
color: #9ca3af !important;
|
|
45
|
+
opacity: 1 !important;
|
|
46
|
+
}
|
|
47
|
+
.header-search-icon-container {
|
|
48
|
+
border-color: #9ca3af;
|
|
49
|
+
}
|
|
50
|
+
.header-search-form:focus-within .header-search-input {
|
|
51
|
+
border-color: #3b82f6 !important;
|
|
52
|
+
box-shadow: 0 0 0 1px #3b82f6;
|
|
53
|
+
}
|
|
54
|
+
.header-search-form:focus-within .header-search-icon-container {
|
|
55
|
+
border-color: #3b82f6 !important;
|
|
56
|
+
box-shadow: 0 0 0 1px #3b82f6;
|
|
57
|
+
}
|
|
58
|
+
@media (max-width: 768px) {
|
|
59
|
+
.header-mobile-layout {
|
|
60
|
+
display: block;
|
|
61
|
+
}
|
|
62
|
+
.header-mobile-top-row {
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: space-between;
|
|
66
|
+
padding: 8px 4px;
|
|
67
|
+
min-height: 48px;
|
|
68
|
+
}
|
|
69
|
+
.header-mobile-search-row {
|
|
70
|
+
display: block;
|
|
71
|
+
padding: 12px 4px 8px 4px;
|
|
72
|
+
}
|
|
73
|
+
.header-desktop-layout {
|
|
74
|
+
display: none !important;
|
|
75
|
+
}
|
|
76
|
+
.header-mobile-layout .header-search-input {
|
|
77
|
+
font-size: 12px !important;
|
|
78
|
+
padding-left: 8px !important;
|
|
79
|
+
padding-right: 8px !important;
|
|
80
|
+
}
|
|
81
|
+
.header-mobile-layout .header-search-icon-container {
|
|
82
|
+
width: 36px !important;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
@media (min-width: 769px) {
|
|
86
|
+
.header-mobile-layout {
|
|
87
|
+
display: none;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
`}</style>
|
|
91
|
+
|
|
92
|
+
<div className="w-full" style={{ paddingLeft: '4px', paddingRight: '4px' }}>
|
|
93
|
+
{/* Layout Desktop (más de 768px) */}
|
|
94
|
+
<div className="header-desktop-layout flex items-center justify-between h-16">
|
|
95
|
+
{/* Barra de búsqueda con icono a la derecha */}
|
|
96
|
+
<div className="flex-1 mr-2 md:mr-4" style={{ maxWidth: 'none', minWidth: '0' }}>
|
|
97
|
+
<form onSubmit={handleSearchSubmit} className="header-search-form flex items-center w-full">
|
|
98
|
+
{/* Input de búsqueda */}
|
|
99
|
+
<input
|
|
100
|
+
type="text"
|
|
101
|
+
value={searchValue}
|
|
102
|
+
onChange={handleSearchChange}
|
|
103
|
+
placeholder={searchPlaceholder}
|
|
104
|
+
className="header-search-input flex-1 pl-2 md:pl-4 pr-2 md:pr-4 py-2 md:py-2.5 bg-white border border-gray-400 rounded-l-lg
|
|
105
|
+
focus:outline-none text-sm md:text-base"
|
|
106
|
+
style={{
|
|
107
|
+
height: '40px',
|
|
108
|
+
borderRight: 'none',
|
|
109
|
+
borderTopRightRadius: '0',
|
|
110
|
+
borderBottomRightRadius: '0',
|
|
111
|
+
color: '#374151',
|
|
112
|
+
fontFamily: 'IBM Plex Sans',
|
|
113
|
+
fontWeight: 400,
|
|
114
|
+
fontStyle: 'italic',
|
|
115
|
+
fontSize: '14px',
|
|
116
|
+
lineHeight: '20px',
|
|
117
|
+
letterSpacing: '0px'
|
|
118
|
+
}}
|
|
42
119
|
/>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
120
|
+
|
|
121
|
+
{/* Recuadro con icono de buscar a la derecha */}
|
|
122
|
+
<div
|
|
123
|
+
className="header-search-icon-container flex items-center justify-center border border-gray-400 rounded-r-lg bg-white"
|
|
124
|
+
style={{
|
|
125
|
+
width: '40px',
|
|
126
|
+
height: '40px',
|
|
127
|
+
borderTopLeftRadius: '0',
|
|
128
|
+
borderBottomLeftRadius: '0'
|
|
129
|
+
}}
|
|
51
130
|
>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
strokeWidth="0.5"
|
|
58
|
-
strokeLinejoin="round"
|
|
131
|
+
<Icon
|
|
132
|
+
name="MagnifyingGlassIcon"
|
|
133
|
+
variant="24-outline"
|
|
134
|
+
size={20}
|
|
135
|
+
className="color-gray-600"
|
|
59
136
|
/>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
137
|
+
</div>
|
|
138
|
+
</form>
|
|
139
|
+
</div>
|
|
140
|
+
|
|
141
|
+
{/* Notificaciones y Perfil */}
|
|
142
|
+
<div className="flex items-center space-x-3 md:space-x-6 flex-shrink-0" style={{ marginLeft: 'auto', paddingRight: '0px' }}>
|
|
143
|
+
{/* Icono de notificaciones */}
|
|
144
|
+
{notificationCount !== undefined && (
|
|
145
|
+
<button
|
|
146
|
+
onClick={onNotificationClick}
|
|
147
|
+
className="relative p-2 hover:bg-gray-100 rounded-lg transition-colors"
|
|
148
|
+
aria-label="Notificaciones"
|
|
149
|
+
>
|
|
150
|
+
<Icon
|
|
151
|
+
name="BellIcon"
|
|
152
|
+
variant="24-outline"
|
|
153
|
+
size={24}
|
|
154
|
+
className="color-gray-600"
|
|
67
155
|
/>
|
|
68
|
-
|
|
156
|
+
{notificationCount > 0 && (
|
|
157
|
+
<span
|
|
158
|
+
className="absolute -top-1 -right-1 px-1.5 py-0.5 min-w-[20px] h-5
|
|
159
|
+
text-white rounded-full flex items-center justify-center
|
|
160
|
+
text-body-sm font-medium"
|
|
161
|
+
style={{
|
|
162
|
+
backgroundColor: '#6D3856',
|
|
163
|
+
borderRadius: '12px'
|
|
164
|
+
}}
|
|
165
|
+
>
|
|
166
|
+
{notificationCount > 9 ? '9+' : notificationCount}
|
|
167
|
+
</span>
|
|
168
|
+
)}
|
|
169
|
+
</button>
|
|
69
170
|
)}
|
|
70
|
-
|
|
71
|
-
{/* Nombre de la empresa */}
|
|
72
|
-
<Typography
|
|
73
|
-
variant="body-md"
|
|
74
|
-
className="color-teal font-bold"
|
|
75
|
-
>
|
|
76
|
-
{companyName}
|
|
77
|
-
</Typography>
|
|
78
|
-
</div>
|
|
79
171
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
172
|
+
{/* Perfil de usuario */}
|
|
173
|
+
{userName && (
|
|
174
|
+
<button
|
|
175
|
+
onClick={onUserClick}
|
|
176
|
+
className="flex items-center space-x-3 hover:bg-gray-50
|
|
177
|
+
rounded-lg px-2 py-1.5 transition-colors"
|
|
178
|
+
aria-label="Perfil de usuario"
|
|
179
|
+
>
|
|
180
|
+
<Avatar
|
|
181
|
+
src={userAvatar}
|
|
182
|
+
name={userName}
|
|
183
|
+
size="medium"
|
|
184
|
+
variant="circle"
|
|
185
|
+
/>
|
|
186
|
+
<Typography
|
|
187
|
+
variant="body-lg"
|
|
188
|
+
className="color-gray-700 hidden md:block"
|
|
189
|
+
style={{
|
|
190
|
+
fontFamily: 'IBM Plex Sans',
|
|
191
|
+
fontWeight: 400,
|
|
192
|
+
fontStyle: 'normal',
|
|
193
|
+
fontSize: '16px',
|
|
194
|
+
lineHeight: '24px',
|
|
195
|
+
letterSpacing: '0%',
|
|
196
|
+
verticalAlign: 'middle'
|
|
197
|
+
}}
|
|
198
|
+
>
|
|
199
|
+
{userName}
|
|
200
|
+
</Typography>
|
|
201
|
+
<Icon
|
|
202
|
+
name="ChevronDownIcon"
|
|
203
|
+
variant="24-outline"
|
|
204
|
+
size={20}
|
|
205
|
+
className="color-gray-500"
|
|
206
|
+
/>
|
|
207
|
+
</button>
|
|
208
|
+
)}
|
|
88
209
|
</div>
|
|
210
|
+
</div>
|
|
89
211
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
212
|
+
{/* Layout Mobile (768px o menos) */}
|
|
213
|
+
<div className="header-mobile-layout">
|
|
214
|
+
{/* Primera fila: Menú, Core, Notificaciones y Avatar */}
|
|
215
|
+
<div className="header-mobile-top-row">
|
|
216
|
+
{/* Lado izquierdo: Menú hamburguesa y Core */}
|
|
217
|
+
<div className="flex items-center space-x-2">
|
|
218
|
+
{/* Botón menú hamburguesa */}
|
|
219
|
+
<button
|
|
220
|
+
className="p-2 hover:bg-gray-100 rounded-lg transition-colors"
|
|
221
|
+
aria-label="Menú"
|
|
222
|
+
>
|
|
223
|
+
<Icon
|
|
224
|
+
name="Bars3Icon"
|
|
225
|
+
variant="24-outline"
|
|
226
|
+
size={24}
|
|
227
|
+
className="color-gray-700"
|
|
228
|
+
/>
|
|
229
|
+
</button>
|
|
230
|
+
|
|
231
|
+
{/* Texto "Core" */}
|
|
98
232
|
<Typography
|
|
99
|
-
variant="
|
|
100
|
-
|
|
233
|
+
variant="h6"
|
|
234
|
+
style={{
|
|
235
|
+
color: '#2D5C63',
|
|
236
|
+
fontSize: '24px',
|
|
237
|
+
fontFamily: 'IBM Plex Sans',
|
|
238
|
+
fontWeight: 600,
|
|
239
|
+
lineHeight: '1.2',
|
|
240
|
+
margin: 0
|
|
241
|
+
}}
|
|
101
242
|
>
|
|
102
|
-
|
|
243
|
+
Core
|
|
103
244
|
</Typography>
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
245
|
+
</div>
|
|
246
|
+
|
|
247
|
+
{/* Lado derecho: Notificaciones y Avatar */}
|
|
248
|
+
<div className="flex items-center space-x-3">
|
|
249
|
+
{/* Icono de notificaciones */}
|
|
250
|
+
{notificationCount !== undefined && (
|
|
251
|
+
<button
|
|
252
|
+
onClick={onNotificationClick}
|
|
253
|
+
className="relative p-2 hover:bg-gray-100 rounded-lg transition-colors"
|
|
254
|
+
aria-label="Notificaciones"
|
|
255
|
+
>
|
|
256
|
+
<Icon
|
|
257
|
+
name="BellIcon"
|
|
258
|
+
variant="24-outline"
|
|
259
|
+
size={24}
|
|
260
|
+
className="color-gray-600"
|
|
261
|
+
/>
|
|
262
|
+
{notificationCount > 0 && (
|
|
263
|
+
<span
|
|
264
|
+
className="absolute -top-1 -right-1 px-1.5 py-0.5 min-w-[20px] h-5
|
|
265
|
+
text-white rounded-full flex items-center justify-center
|
|
266
|
+
text-body-sm font-medium"
|
|
267
|
+
style={{
|
|
268
|
+
backgroundColor: '#6D3856',
|
|
269
|
+
borderRadius: '12px'
|
|
270
|
+
}}
|
|
271
|
+
>
|
|
272
|
+
{notificationCount > 9 ? '9+' : notificationCount}
|
|
273
|
+
</span>
|
|
274
|
+
)}
|
|
275
|
+
</button>
|
|
276
|
+
)}
|
|
277
|
+
|
|
278
|
+
{/* Avatar (sin nombre) */}
|
|
279
|
+
{userAvatar && (
|
|
280
|
+
<button
|
|
281
|
+
onClick={onUserClick}
|
|
282
|
+
className="hover:bg-gray-50 rounded-lg transition-colors"
|
|
283
|
+
aria-label="Perfil de usuario"
|
|
284
|
+
>
|
|
285
|
+
<Avatar
|
|
286
|
+
src={userAvatar}
|
|
287
|
+
name={userName || ''}
|
|
288
|
+
size="medium"
|
|
289
|
+
variant="circle"
|
|
290
|
+
/>
|
|
291
|
+
</button>
|
|
292
|
+
)}
|
|
293
|
+
</div>
|
|
294
|
+
</div>
|
|
295
|
+
|
|
296
|
+
{/* Segunda fila: Barra de búsqueda */}
|
|
297
|
+
<div className="header-mobile-search-row">
|
|
298
|
+
<form onSubmit={handleSearchSubmit} className="header-search-form flex items-center w-full">
|
|
299
|
+
{/* Input de búsqueda */}
|
|
300
|
+
<input
|
|
301
|
+
type="text"
|
|
302
|
+
value={searchValue}
|
|
303
|
+
onChange={handleSearchChange}
|
|
304
|
+
placeholder={searchPlaceholder}
|
|
305
|
+
className="header-search-input flex-1 pl-3 pr-3 py-2 bg-white border border-gray-400 rounded-l-lg
|
|
306
|
+
focus:outline-none text-sm"
|
|
307
|
+
style={{
|
|
308
|
+
height: '40px',
|
|
309
|
+
borderRight: 'none',
|
|
310
|
+
borderTopRightRadius: '0',
|
|
311
|
+
borderBottomRightRadius: '0',
|
|
312
|
+
color: '#374151',
|
|
313
|
+
fontFamily: 'IBM Plex Sans',
|
|
314
|
+
fontWeight: 400,
|
|
315
|
+
fontStyle: 'italic',
|
|
316
|
+
fontSize: '14px',
|
|
317
|
+
lineHeight: '20px',
|
|
318
|
+
letterSpacing: '0px'
|
|
319
|
+
}}
|
|
109
320
|
/>
|
|
110
|
-
|
|
321
|
+
|
|
322
|
+
{/* Recuadro con icono de buscar a la derecha */}
|
|
323
|
+
<div
|
|
324
|
+
className="header-search-icon-container flex items-center justify-center border border-gray-400 rounded-r-lg bg-white"
|
|
325
|
+
style={{
|
|
326
|
+
width: '40px',
|
|
327
|
+
height: '40px',
|
|
328
|
+
borderTopLeftRadius: '0',
|
|
329
|
+
borderBottomLeftRadius: '0'
|
|
330
|
+
}}
|
|
331
|
+
>
|
|
332
|
+
<Icon
|
|
333
|
+
name="MagnifyingGlassIcon"
|
|
334
|
+
variant="24-outline"
|
|
335
|
+
size={20}
|
|
336
|
+
className="color-gray-600"
|
|
337
|
+
/>
|
|
338
|
+
</div>
|
|
339
|
+
</form>
|
|
111
340
|
</div>
|
|
112
341
|
</div>
|
|
113
342
|
</div>
|
|
@@ -9,47 +9,51 @@ export default {
|
|
|
9
9
|
export const Default = {
|
|
10
10
|
render: () => (
|
|
11
11
|
<HeaderCore
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
searchPlaceholder="Buscar empleados, reportes, configuraciones..."
|
|
13
|
+
userName="Maria García Alonso"
|
|
14
|
+
userAvatar="https://i.pravatar.cc/150?img=12"
|
|
15
|
+
notificationCount={7}
|
|
16
|
+
onSearch={(value) => console.log('Búsqueda:', value)}
|
|
17
|
+
onNotificationClick={() => console.log('Notificaciones clickeadas')}
|
|
18
|
+
onUserClick={() => console.log('Usuario clickeado')}
|
|
18
19
|
/>
|
|
19
20
|
),
|
|
20
21
|
};
|
|
21
22
|
|
|
22
|
-
export const
|
|
23
|
+
export const SinNotificaciones = {
|
|
23
24
|
render: () => (
|
|
24
25
|
<HeaderCore
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
searchPlaceholder="Buscar empleados, reportes, configuraciones..."
|
|
27
|
+
userName="Juan Pérez"
|
|
28
|
+
userAvatar="https://i.pravatar.cc/150?img=33"
|
|
29
|
+
notificationCount={0}
|
|
28
30
|
/>
|
|
29
31
|
),
|
|
30
32
|
};
|
|
31
33
|
|
|
32
|
-
export const
|
|
34
|
+
export const ConMuchasNotificaciones = {
|
|
33
35
|
render: () => (
|
|
34
36
|
<HeaderCore
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
pointLabel="Mi Punto"
|
|
37
|
+
searchPlaceholder="Buscar empleados, reportes, configuraciones..."
|
|
38
|
+
userName="Ana Martínez"
|
|
39
|
+
userAvatar="https://i.pravatar.cc/150?img=47"
|
|
40
|
+
notificationCount={15}
|
|
40
41
|
/>
|
|
41
42
|
),
|
|
42
43
|
};
|
|
43
44
|
|
|
44
|
-
export const
|
|
45
|
+
export const SinUsuario = {
|
|
45
46
|
render: () => (
|
|
46
47
|
<HeaderCore
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
newElementLabel="AGREGAR"
|
|
50
|
-
pointLabel="ACME Hub"
|
|
48
|
+
searchPlaceholder="Buscar empleados, reportes, configuraciones..."
|
|
49
|
+
notificationCount={3}
|
|
51
50
|
/>
|
|
52
51
|
),
|
|
53
52
|
};
|
|
54
53
|
|
|
55
54
|
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { Icon } from '../../Atoms/Icon/Icon';
|
|
3
|
+
import { Typography } from '../../Atoms/Typography/Typography';
|
|
4
|
+
import { LogoHexa } from '../../Atoms/LogoHexa/LogoHexa';
|
|
5
|
+
|
|
6
|
+
export const HeaderGeneral = ({
|
|
7
|
+
logoText = 'HEXA',
|
|
8
|
+
suiteText = 'Suite',
|
|
9
|
+
languages = [
|
|
10
|
+
{ code: 'es-AR', name: 'Español' },
|
|
11
|
+
{ code: 'en', name: 'English' },
|
|
12
|
+
],
|
|
13
|
+
currentLanguageCode = 'es-AR',
|
|
14
|
+
onLanguageChange,
|
|
15
|
+
className = '',
|
|
16
|
+
...props
|
|
17
|
+
}) => {
|
|
18
|
+
const [isLanguageOpen, setIsLanguageOpen] = useState(false);
|
|
19
|
+
|
|
20
|
+
const currentLanguage = languages.find(lang => lang.code === currentLanguageCode) || languages[0];
|
|
21
|
+
|
|
22
|
+
const handleLanguageChange = (langCode) => {
|
|
23
|
+
if (onLanguageChange) {
|
|
24
|
+
onLanguageChange(langCode);
|
|
25
|
+
}
|
|
26
|
+
setIsLanguageOpen(false);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<header className={`w-full flex justify-between items-center bg-white ${className}`} style={{ paddingTop: '4px', paddingBottom: '4px', paddingLeft: '8px', paddingRight: '12px' }} {...props}>
|
|
31
|
+
{/* Logo */}
|
|
32
|
+
<div className="flex items-center gap-2">
|
|
33
|
+
<LogoHexa width={32} height={36} />
|
|
34
|
+
<div className="flex items-center" style={{ gap: '4px' }}>
|
|
35
|
+
<Typography variant="h6" className="font-normal" style={{ color: '#2D5C63', margin: 0 }}>
|
|
36
|
+
{logoText}
|
|
37
|
+
</Typography>
|
|
38
|
+
<Typography variant="h6" className="font-normal" style={{ color: '#2D5C63', margin: 0 }}>
|
|
39
|
+
{suiteText}
|
|
40
|
+
</Typography>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
{/* Language Selector - Solo se muestra si hay idiomas */}
|
|
45
|
+
{languages && languages.length > 0 && (
|
|
46
|
+
<div className="relative flex items-center gap-2">
|
|
47
|
+
<Icon name="LanguageIcon" variant="24-outline" size={18} style={{ color: '#374151' }} />
|
|
48
|
+
<button
|
|
49
|
+
onClick={() => setIsLanguageOpen(!isLanguageOpen)}
|
|
50
|
+
className="flex items-center gap-2 px-3 py-2 text-body-md color-gray-700 bg-white hover:bg-gray-50 rounded-lg transition-colors"
|
|
51
|
+
style={{ border: '1px solid #2D5C63' }}
|
|
52
|
+
>
|
|
53
|
+
<span>{currentLanguage.name}</span>
|
|
54
|
+
<Icon
|
|
55
|
+
name="ChevronDownIcon"
|
|
56
|
+
variant="24-outline"
|
|
57
|
+
size={16}
|
|
58
|
+
className={`transition-transform ${isLanguageOpen ? 'rotate-180' : ''}`}
|
|
59
|
+
/>
|
|
60
|
+
</button>
|
|
61
|
+
|
|
62
|
+
{isLanguageOpen && (
|
|
63
|
+
<>
|
|
64
|
+
<div
|
|
65
|
+
className="fixed inset-0 z-10"
|
|
66
|
+
onClick={() => setIsLanguageOpen(false)}
|
|
67
|
+
/>
|
|
68
|
+
<div className="absolute right-0 mt-2 w-40 bg-white rounded-lg shadow-lg z-20 py-1" style={{ border: '1px solid #2D5C63' }}>
|
|
69
|
+
{languages.map((lang) => (
|
|
70
|
+
<button
|
|
71
|
+
key={lang.code}
|
|
72
|
+
onClick={() => handleLanguageChange(lang.code)}
|
|
73
|
+
className={`w-full text-left px-4 py-2 text-body-md hover:bg-gray-50 transition-colors ${
|
|
74
|
+
currentLanguage.code === lang.code
|
|
75
|
+
? 'bg-gray-50 color-brand font-medium'
|
|
76
|
+
: 'color-gray-700'
|
|
77
|
+
}`}
|
|
78
|
+
>
|
|
79
|
+
{lang.name}
|
|
80
|
+
</button>
|
|
81
|
+
))}
|
|
82
|
+
</div>
|
|
83
|
+
</>
|
|
84
|
+
)}
|
|
85
|
+
</div>
|
|
86
|
+
)}
|
|
87
|
+
</header>
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export default HeaderGeneral;
|
|
92
|
+
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { HeaderGeneral } from './HeaderGeneral';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Layout/HeaderGeneral',
|
|
5
|
+
component: HeaderGeneral,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const Default = {
|
|
10
|
+
render: () => (
|
|
11
|
+
<HeaderGeneral
|
|
12
|
+
logoText="HEXA"
|
|
13
|
+
suiteText="Suite"
|
|
14
|
+
languages={[
|
|
15
|
+
{ code: 'es-AR', name: 'Español' },
|
|
16
|
+
{ code: 'en', name: 'English' },
|
|
17
|
+
]}
|
|
18
|
+
currentLanguageCode="es-AR"
|
|
19
|
+
onLanguageChange={(langCode) => console.log('Idioma cambiado:', langCode)}
|
|
20
|
+
/>
|
|
21
|
+
),
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const ConIdiomaIngles = {
|
|
25
|
+
render: () => (
|
|
26
|
+
<HeaderGeneral
|
|
27
|
+
logoText="HEXA"
|
|
28
|
+
suiteText="Suite"
|
|
29
|
+
languages={[
|
|
30
|
+
{ code: 'es-AR', name: 'Español' },
|
|
31
|
+
{ code: 'en', name: 'English' },
|
|
32
|
+
]}
|
|
33
|
+
currentLanguageCode="en"
|
|
34
|
+
onLanguageChange={(langCode) => console.log('Idioma cambiado:', langCode)}
|
|
35
|
+
/>
|
|
36
|
+
),
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const ConTextosPersonalizados = {
|
|
40
|
+
render: () => (
|
|
41
|
+
<HeaderGeneral
|
|
42
|
+
logoText="MI"
|
|
43
|
+
suiteText="EMPRESA"
|
|
44
|
+
languages={[
|
|
45
|
+
{ code: 'es-AR', name: 'Español' },
|
|
46
|
+
{ code: 'en', name: 'English' },
|
|
47
|
+
{ code: 'pt', name: 'Português' },
|
|
48
|
+
]}
|
|
49
|
+
currentLanguageCode="es-AR"
|
|
50
|
+
onLanguageChange={(langCode) => console.log('Idioma cambiado:', langCode)}
|
|
51
|
+
/>
|
|
52
|
+
),
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const SinIdiomas = {
|
|
56
|
+
render: () => (
|
|
57
|
+
<HeaderGeneral
|
|
58
|
+
logoText="HEXA"
|
|
59
|
+
suiteText="Suite"
|
|
60
|
+
languages={[]}
|
|
61
|
+
/>
|
|
62
|
+
),
|
|
63
|
+
};
|
|
64
|
+
|