dgrcorrientes-modulos 1.0.0
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/.nvmrc +1 -0
- package/.prettierrc.cjs +8 -0
- package/.storybook/main.cjs +11 -0
- package/.storybook/manager-head.html +2 -0
- package/.storybook/manager.cjs +6 -0
- package/.storybook/preview-head.html +3 -0
- package/.storybook/preview.cjs +11 -0
- package/.storybook/themes.cjs +14 -0
- package/README.md +21 -0
- package/StoryBook.txt +19 -0
- package/dist-config.cjs +57 -0
- package/index.html +13 -0
- package/package.json +60 -0
- package/public/elevation.ico +0 -0
- package/public/elevationImage.png +0 -0
- package/public/vite.svg +1 -0
- package/src/App.scss +36 -0
- package/src/App.tsx +34 -0
- package/src/assets/react.svg +1 -0
- package/src/index.js +70 -0
- package/src/index.scss +63 -0
- package/src/index.ts +108 -0
- package/src/main.tsx +11 -0
- package/src/sass/base/_base.scss +50 -0
- package/src/sass/base/_controls.scss +90 -0
- package/src/sass/base/_datepicker.scss +114 -0
- package/src/sass/base/_typo.scss +71 -0
- package/src/sass/base/fonts/SFUIText-Bold.ttf +0 -0
- package/src/sass/base/fonts/SFUIText-BoldItalic.ttf +0 -0
- package/src/sass/base/fonts/SFUIText-Heavy.ttf +0 -0
- package/src/sass/base/fonts/SFUIText-HeavyItalic.ttf +0 -0
- package/src/sass/base/fonts/SFUIText-Light.ttf +0 -0
- package/src/sass/base/fonts/SFUIText-LightItalic.ttf +0 -0
- package/src/sass/base/fonts/SFUIText-Medium.ttf +0 -0
- package/src/sass/base/fonts/SFUIText-MediumItalic.ttf +0 -0
- package/src/sass/base/fonts/SFUIText-Regular.ttf +0 -0
- package/src/sass/base/fonts/SFUIText-RegularItalic.ttf +0 -0
- package/src/sass/base/fonts/SFUIText-Semibold.ttf +0 -0
- package/src/sass/base/fonts/SFUIText-SemiboldItalic.ttf +0 -0
- package/src/sass/bulma/bulma-changes.scss +19 -0
- package/src/sass/bulma/extensions/extensions.sass +1 -0
- package/src/sass/bulma/extensions/steps/bulma-steps.sass +3 -0
- package/src/sass/bulma/extensions/steps/index.sass +421 -0
- package/src/sass/bulma/variables/_variables-bulma.sass +16 -0
- package/src/sass/bulma/variables/components/card.sass +20 -0
- package/src/sass/bulma/variables/components/navbar.sass +50 -0
- package/src/sass/bulma/variables/components/tabs.sass +28 -0
- package/src/sass/bulma/variables/elements/button.sass +46 -0
- package/src/sass/bulma/variables/elements/notification.sass +8 -0
- package/src/sass/bulma/variables/elements/title.sass +20 -0
- package/src/sass/bulma/variables/grid/column.sass +2 -0
- package/src/sass/main.sass +16 -0
- package/src/sass/utilities/_bulma-variables.sass +20 -0
- package/src/sass/utilities/_derived-variables.scss +68 -0
- package/src/sass/utilities/_helpers.scss +70 -0
- package/src/sass/utilities/_variables.scss +147 -0
- package/src/stories/Changelog.stories.tsx +73 -0
- package/src/stories/Components/AssistanceDiary/AssistanceDiary.scss +19 -0
- package/src/stories/Components/AssistanceDiary/AssistanceDiary.stories.tsx +25 -0
- package/src/stories/Components/AssistanceDiary/AssistanceDiary.tsx +57 -0
- package/src/stories/Components/AverageAttended/AverageAttended.scss +39 -0
- package/src/stories/Components/AverageAttended/AverageAttended.stories.tsx +71 -0
- package/src/stories/Components/AverageAttended/AverageAttended.tsx +311 -0
- package/src/stories/Components/Breadcrumb/Breadcrumb.stories.tsx +45 -0
- package/src/stories/Components/Breadcrumb/Breadcrumb.tsx +68 -0
- package/src/stories/Components/Breadcrumb/breadcrumb.scss +82 -0
- package/src/stories/Components/CTA/CTA.scss +76 -0
- package/src/stories/Components/CTA/CTA.stories.tsx +46 -0
- package/src/stories/Components/CTA/CTA.tsx +70 -0
- package/src/stories/Components/Cards/Card CTA/CardCta.stories.tsx +34 -0
- package/src/stories/Components/Cards/Card CTA/CardCta.tsx +81 -0
- package/src/stories/Components/Cards/Card CTA/cardCta.scss +71 -0
- package/src/stories/Components/Cards/Card Expiration/cardExpiration.scss +105 -0
- package/src/stories/Components/Cards/Card Expiration/cardExpiration.stories.tsx +40 -0
- package/src/stories/Components/Cards/Card Expiration/cardExpiration.tsx +95 -0
- package/src/stories/Components/Cards/Card Vertical/CardVertical.stories.tsx +43 -0
- package/src/stories/Components/Cards/Card Vertical/CardVertical.tsx +106 -0
- package/src/stories/Components/Cards/Card Vertical/cardVertical.scss +130 -0
- package/src/stories/Components/Cards/CardActivity/cardActivity.scss +31 -0
- package/src/stories/Components/Cards/CardActivity/cardActivity.stories.tsx +20 -0
- package/src/stories/Components/Cards/CardActivity/cardActivity.tsx +48 -0
- package/src/stories/Components/Cards/CardHorizontal/CardHorizontal.stories.tsx +96 -0
- package/src/stories/Components/Cards/CardHorizontal/CardHorizontal.tsx +94 -0
- package/src/stories/Components/Cards/CardHorizontal/cardHorizontal.scss +65 -0
- package/src/stories/Components/Cards/CardUser/CardUser.stories.tsx +135 -0
- package/src/stories/Components/Cards/CardUser/CardUser.tsx +122 -0
- package/src/stories/Components/Cards/CardUser/cardUser.scss +115 -0
- package/src/stories/Components/Cart/Cart.scss +279 -0
- package/src/stories/Components/Cart/Cart.stories.tsx +350 -0
- package/src/stories/Components/Cart/Cart.tsx +277 -0
- package/src/stories/Components/Collapse/Collapse.scss +339 -0
- package/src/stories/Components/Collapse/Collapse.stories.tsx +766 -0
- package/src/stories/Components/Collapse/Collapse.tsx +451 -0
- package/src/stories/Components/CollapseEdit/CollapseEdit.scss +128 -0
- package/src/stories/Components/CollapseEdit/CollapseEdit.stories.tsx +29 -0
- package/src/stories/Components/CollapseEdit/CollapseEdit.tsx +185 -0
- package/src/stories/Components/CompleteDiary/CompleteDiary.scss +165 -0
- package/src/stories/Components/CompleteDiary/CompleteDiary.stories.tsx +219 -0
- package/src/stories/Components/CompleteDiary/CompleteDiary.tsx +394 -0
- package/src/stories/Components/Dropdown/Dropdown.scss +60 -0
- package/src/stories/Components/Dropdown/Dropdown.stories.tsx +19 -0
- package/src/stories/Components/Dropdown/Dropdown.tsx +99 -0
- package/src/stories/Components/EmptyState/EmptyState.stories.tsx +46 -0
- package/src/stories/Components/EmptyState/EmptyState.tsx +44 -0
- package/src/stories/Components/EmptyState/emptyState.scss +75 -0
- package/src/stories/Components/ErrorPage/ErrorPage.scss +65 -0
- package/src/stories/Components/ErrorPage/ErrorPage.stories.tsx +164 -0
- package/src/stories/Components/ErrorPage/ErrorPage.tsx +107 -0
- package/src/stories/Components/IncomingCall/IncomingCall.scss +27 -0
- package/src/stories/Components/IncomingCall/IncomingCall.stories.tsx +43 -0
- package/src/stories/Components/IncomingCall/IncomingCall.tsx +76 -0
- package/src/stories/Components/ModalConfirm/ModalConfirm.scss +30 -0
- package/src/stories/Components/ModalConfirm/ModalConfirm.stories.tsx +21 -0
- package/src/stories/Components/ModalConfirm/ModalConfirm.tsx +118 -0
- package/src/stories/Components/Pagination/Pagination.scss +42 -0
- package/src/stories/Components/Pagination/Pagination.stories.tsx +25 -0
- package/src/stories/Components/Pagination/Pagination.tsx +143 -0
- package/src/stories/Components/PerformanceAssessment/PerformanceAssessment.scss +26 -0
- package/src/stories/Components/PerformanceAssessment/PerformanceAssessment.stories.tsx +27 -0
- package/src/stories/Components/PerformanceAssessment/PerformanceAssessment.tsx +108 -0
- package/src/stories/Components/ShiftDiary/ShiftDiary.scss +45 -0
- package/src/stories/Components/ShiftDiary/ShiftDiary.stories.tsx +32 -0
- package/src/stories/Components/ShiftDiary/ShiftDiary.tsx +92 -0
- package/src/stories/Components/Stepper/Stepper.stories.tsx +26 -0
- package/src/stories/Components/Stepper/Stepper.tsx +102 -0
- package/src/stories/Components/Stepper/stepper.scss +59 -0
- package/src/stories/Components/Tabs/Tabs.stories.tsx +76 -0
- package/src/stories/Components/Tabs/Tabs.tsx +111 -0
- package/src/stories/Components/Tabs/tabs.scss +118 -0
- package/src/stories/Components/Tooltip/Tooltip.scss +235 -0
- package/src/stories/Components/Tooltip/Tooltip.stories.tsx +125 -0
- package/src/stories/Components/Tooltip/Tooltip.tsx +222 -0
- package/src/stories/Elements/Alert/Alert.stories.tsx +65 -0
- package/src/stories/Elements/Alert/Alert.tsx +49 -0
- package/src/stories/Elements/Alert/alert.scss +189 -0
- package/src/stories/Elements/Badge/Badge.stories.tsx +15 -0
- package/src/stories/Elements/Badge/Badge.tsx +21 -0
- package/src/stories/Elements/Badge/badge.scss +24 -0
- package/src/stories/Elements/Button/Button.stories.tsx +54 -0
- package/src/stories/Elements/Button/Button.tsx +118 -0
- package/src/stories/Elements/Button/button.scss +102 -0
- package/src/stories/Elements/Icon/Icon.stories.tsx +33 -0
- package/src/stories/Elements/Icon/Icon.tsx +57 -0
- package/src/stories/Elements/Icon/icon.scss +15 -0
- package/src/stories/Elements/Icon/icono.svg +1 -0
- package/src/stories/Elements/ProgressBar/ProgressBar.scss +26 -0
- package/src/stories/Elements/ProgressBar/ProgressBar.stories.tsx +19 -0
- package/src/stories/Elements/ProgressBar/ProgressBar.tsx +35 -0
- package/src/stories/Form/Autocomplete/Autocomplete.stories.tsx +55 -0
- package/src/stories/Form/Autocomplete/Autocomplete.tsx +160 -0
- package/src/stories/Form/Autocomplete/autocomplete.scss +311 -0
- package/src/stories/Form/Autocomplete-Prueba/Autocomplete.stories.tsx +50 -0
- package/src/stories/Form/Autocomplete-Prueba/AutocompletePrueba.tsx +83 -0
- package/src/stories/Form/Checkbox/Checkbox.stories.tsx +26 -0
- package/src/stories/Form/Checkbox/Checkbox.tsx +89 -0
- package/src/stories/Form/Checkbox/checkbox.scss +41 -0
- package/src/stories/Form/DatePicker/DatePickerExample.stories.tsx +27 -0
- package/src/stories/Form/DatePicker/DatePickerExample.tsx +65 -0
- package/src/stories/Form/DatePickerComponent/DatePickerComponent.scss +116 -0
- package/src/stories/Form/DatePickerComponent/DatePickerComponent.stories.tsx +37 -0
- package/src/stories/Form/DatePickerComponent/DatePickerComponent.tsx +97 -0
- package/src/stories/Form/Filters/Filters.stories.tsx +84 -0
- package/src/stories/Form/Filters/Filters.tsx +230 -0
- package/src/stories/Form/Filters/filters.scss +261 -0
- package/src/stories/Form/Input/Input.stories.tsx +25 -0
- package/src/stories/Form/Input/Input.tsx +86 -0
- package/src/stories/Form/Input/InputVar.sass +26 -0
- package/src/stories/Form/Input/input.scss +19 -0
- package/src/stories/Form/InputFormControl/Input-form-control.stories.tsx +26 -0
- package/src/stories/Form/InputFormControl/Input-form-control.tsx +48 -0
- package/src/stories/Form/InputFormControl/input-form-control.scss +34 -0
- package/src/stories/Form/Radio/Radio.stories.tsx +19 -0
- package/src/stories/Form/Radio/Radio.tsx +84 -0
- package/src/stories/Form/Radio/radio.scss +19 -0
- package/src/stories/Form/Search/Search.scss +50 -0
- package/src/stories/Form/Search/Search.stories.tsx +26 -0
- package/src/stories/Form/Search/Search.tsx +84 -0
- package/src/stories/Form/Select/Select.stories.tsx +55 -0
- package/src/stories/Form/Select/Select.tsx +121 -0
- package/src/stories/Form/Select/select.scss +303 -0
- package/src/stories/Form/Switch/Switch.stories.tsx +17 -0
- package/src/stories/Form/Switch/Switch.tsx +36 -0
- package/src/stories/Form/Switch/switch.scss +123 -0
- package/src/stories/Form/Textarea/Textarea.stories.tsx +19 -0
- package/src/stories/Form/Textarea/Textarea.tsx +52 -0
- package/src/stories/Form/Textarea/textarea.scss +25 -0
- package/src/stories/Form/UploadFileItem/UploadFileItem.scss +49 -0
- package/src/stories/Form/UploadFileItem/UploadFileItem.stories.tsx +18 -0
- package/src/stories/Form/UploadFileItem/UploadFileItem.tsx +89 -0
- package/src/stories/Form/UploadFiles/UploadFiles.scss +17 -0
- package/src/stories/Form/UploadFiles/UploadFiles.stories.tsx +32 -0
- package/src/stories/Form/UploadFiles/UploadFiles.tsx +177 -0
- package/src/stories/Layout/Footer/Footer.scss +129 -0
- package/src/stories/Layout/Footer/Footer.stories.tsx +101 -0
- package/src/stories/Layout/Footer/Footer.tsx +81 -0
- package/src/stories/Layout/Header/Header.scss +190 -0
- package/src/stories/Layout/Header/Header.stories.tsx +223 -0
- package/src/stories/Layout/Header/Header.tsx +278 -0
- package/src/stories/Layout/HeaderTable/HeaderTable.scss +21 -0
- package/src/stories/Layout/HeaderTable/HeaderTable.stories.tsx +112 -0
- package/src/stories/Layout/HeaderTable/HeaderTable.tsx +72 -0
- package/src/stories/Layout/Sidebar/Sidebar.scss +50 -0
- package/src/stories/Layout/Sidebar/Sidebar.stories.tsx +744 -0
- package/src/stories/Layout/Sidebar/Sidebar.tsx +129 -0
- package/src/stories/Layout/SidebarEmpty/SidebarEmpty.scss +64 -0
- package/src/stories/Layout/SidebarEmpty/SidebarEmpty.stories.tsx +26 -0
- package/src/stories/Layout/SidebarEmpty/SidebarEmpty.tsx +100 -0
- package/src/stories/Layout/Subtitle/Subtitle.scss +88 -0
- package/src/stories/Layout/Subtitle/Subtitle.stories.tsx +46 -0
- package/src/stories/Layout/Subtitle/Subtitle.tsx +108 -0
- package/src/stories/Layout/Title/Title.scss +79 -0
- package/src/stories/Layout/Title/Title.stories.tsx +86 -0
- package/src/stories/Layout/Title/Title.tsx +96 -0
- package/src/stories/Welcome.stories.tsx +111 -0
- package/src/stories/assets/404 Page Not Found _Two Color (1).png +0 -0
- package/src/stories/assets/404 Page Not Found _Two Color.png +0 -0
- package/src/stories/assets/Empty Inbox _Two Color.png +0 -0
- package/src/stories/assets/Loading _Two Color.png +0 -0
- package/src/stories/assets/Notifications_Two Color 1.png +0 -0
- package/src/stories/assets/Online protection_Two Color.png +0 -0
- package/src/stories/assets/Under Constructions _Two Color.png +0 -0
- package/src/stories/assets/bulma.png +0 -0
- package/src/stories/assets/burger.svg +5 -0
- package/src/stories/assets/code-brackets.svg +1 -0
- package/src/stories/assets/colors.svg +1 -0
- package/src/stories/assets/comments.svg +1 -0
- package/src/stories/assets/decor-bg.png +0 -0
- package/src/stories/assets/direction.svg +1 -0
- package/src/stories/assets/e-isologo.svg +4 -0
- package/src/stories/assets/e-isotype.svg +4 -0
- package/src/stories/assets/e-logo_negative.svg +14 -0
- package/src/stories/assets/e-logotype.svg +14 -0
- package/src/stories/assets/flow.svg +1 -0
- package/src/stories/assets/logo_gobierno_corrientes.svg +9 -0
- package/src/stories/assets/logo_rentas_corrientes.svg +10 -0
- package/src/stories/assets/logo_rentas_corrientes_compacto.svg +10 -0
- package/src/stories/assets/plugin.svg +1 -0
- package/src/stories/assets/repo.svg +1 -0
- package/src/stories/assets/stackalt.svg +1 -0
- package/src/stories/assets/storybook.svg +13 -0
- package/src/stories/assets/thumbnail-black.jpg +0 -0
- package/src/stories/assets/thumbnail-black[2].jpg +0 -0
- package/src/stories/assets/thumbnail.jpg +0 -0
- package/src/stories/assets/thumbnail[2].jpg +0 -0
- package/src/stories/changelog.ts +389 -0
- package/src/utils/functions.ts +57 -0
- package/src/vite-env.d.ts +2 -0
- package/static/e-isologo-192.jpg +0 -0
- package/static/e-isologo.svg +4 -0
- package/static/e-logotype.svg +14 -0
- package/static/favicon.ico +0 -0
- package/tsconfig.json +22 -0
- package/tsconfig.node.json +9 -0
- package/vite.config.ts +22 -0
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
import {useEffect, useRef, useState} from 'react';
|
|
2
|
+
import {Button} from '../../Elements/Button/Button';
|
|
3
|
+
import {Icon} from '../../Elements/Icon/Icon';
|
|
4
|
+
import './CompleteDiary.scss';
|
|
5
|
+
import DatePicker from 'react-datepicker';
|
|
6
|
+
import 'react-datepicker/dist/react-datepicker.css';
|
|
7
|
+
import {Tooltip} from '../Tooltip/Tooltip';
|
|
8
|
+
|
|
9
|
+
export interface ICompleteDiary {
|
|
10
|
+
// BASE
|
|
11
|
+
title?: string;
|
|
12
|
+
labelName?: string;
|
|
13
|
+
labelCuit?: string;
|
|
14
|
+
labelStatus?: string;
|
|
15
|
+
shifts: IShifts[];
|
|
16
|
+
changeDate?: string;
|
|
17
|
+
labelAll?: string;
|
|
18
|
+
labelPresent?: string;
|
|
19
|
+
labelMissing?: string;
|
|
20
|
+
labelCatered?: string;
|
|
21
|
+
iconText?: string;
|
|
22
|
+
scheduleRest: IScheduleRest;
|
|
23
|
+
|
|
24
|
+
// IS-OPTIONS
|
|
25
|
+
showDiary?: boolean;
|
|
26
|
+
|
|
27
|
+
// EVENTS
|
|
28
|
+
onCancel?: () => void;
|
|
29
|
+
onAttend?: () => void;
|
|
30
|
+
onEllipse?: () => void;
|
|
31
|
+
onDate?: (date: Date | null) => void;
|
|
32
|
+
|
|
33
|
+
// GENERIC
|
|
34
|
+
className?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface IShifts {
|
|
37
|
+
hour?: number;
|
|
38
|
+
minute?: string;
|
|
39
|
+
name?: string;
|
|
40
|
+
cuit?: string;
|
|
41
|
+
status?: 'Presente' | 'Ausente' | 'Atendido';
|
|
42
|
+
colorBackgroundState?: string;
|
|
43
|
+
iconColor?: string;
|
|
44
|
+
showButton?: boolean;
|
|
45
|
+
colorBackground?: string;
|
|
46
|
+
menuDropComponent?: React.ReactNode;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface IScheduleRest {
|
|
50
|
+
start: Date;
|
|
51
|
+
end: Date;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const CompleteDiary = ({
|
|
55
|
+
title,
|
|
56
|
+
labelName,
|
|
57
|
+
labelCuit,
|
|
58
|
+
labelStatus,
|
|
59
|
+
iconText,
|
|
60
|
+
shifts,
|
|
61
|
+
changeDate,
|
|
62
|
+
labelAll,
|
|
63
|
+
labelPresent,
|
|
64
|
+
labelMissing,
|
|
65
|
+
labelCatered,
|
|
66
|
+
showDiary,
|
|
67
|
+
scheduleRest,
|
|
68
|
+
onCancel,
|
|
69
|
+
onAttend,
|
|
70
|
+
onEllipse,
|
|
71
|
+
onDate,
|
|
72
|
+
className,
|
|
73
|
+
}: ICompleteDiary) => {
|
|
74
|
+
const [turnos, setTurnos] = useState(shifts);
|
|
75
|
+
const [filterState, setfilterState] = useState<string | null>(null);
|
|
76
|
+
const [currentTime, setCurrentTime] = useState(new Date());
|
|
77
|
+
const [selectedDate, setSelectedDate] = useState<Date | null>(null);
|
|
78
|
+
const [quantitypresent, setquantitypresent] = useState<number>(0);
|
|
79
|
+
const [quantitymissing, setquantitymissing] = useState<number>(0);
|
|
80
|
+
const [quantitycatered, setquantitycatered] = useState<number>(0);
|
|
81
|
+
const [totalQuantity, settotalQuantity] = useState<number>(0);
|
|
82
|
+
const [menuExpanded, setMenuExpanded] = useState(false);
|
|
83
|
+
const [expandedTooltip, setExpandedTooltip] = useState(false);
|
|
84
|
+
const startTime = 8 * 60; // 8:00 AM en minutos
|
|
85
|
+
const endTime = 18 * 60; // 6:00 PM en minutos
|
|
86
|
+
|
|
87
|
+
const menuDropRef = useRef<HTMLDivElement>(null);
|
|
88
|
+
const tooltipMenuRef = useRef<HTMLDivElement>(null);
|
|
89
|
+
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
function handleClickOutside(event: MouseEvent) {
|
|
92
|
+
// Verificar si el primer menú está desplegado y el clic no ocurrió dentro de él
|
|
93
|
+
if (menuDropRef.current && menuExpanded) {
|
|
94
|
+
if (!menuDropRef.current.contains(event.target as Node)) {
|
|
95
|
+
setMenuExpanded(false);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Verificar si el segundo menú está desplegado y el clic no ocurrió dentro de él
|
|
100
|
+
if (tooltipMenuRef.current && expandedTooltip) {
|
|
101
|
+
if (!tooltipMenuRef.current.contains(event.target as Node)) {
|
|
102
|
+
setExpandedTooltip(false);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
document.addEventListener('click', handleClickOutside);
|
|
108
|
+
|
|
109
|
+
return () => {
|
|
110
|
+
document.removeEventListener('click', handleClickOutside);
|
|
111
|
+
};
|
|
112
|
+
}, [menuDropRef, menuExpanded, tooltipMenuRef, expandedTooltip]);
|
|
113
|
+
|
|
114
|
+
const shiftsfilteredref = useRef<IShifts[]>([]);
|
|
115
|
+
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
const intervalId = setInterval(() => {
|
|
118
|
+
setCurrentTime(new Date());
|
|
119
|
+
}, 1000);
|
|
120
|
+
|
|
121
|
+
return () => clearInterval(intervalId);
|
|
122
|
+
}, []);
|
|
123
|
+
|
|
124
|
+
const formatTime = (date: Date) => {
|
|
125
|
+
return date.toLocaleTimeString([], {hour: '2-digit', minute: '2-digit'});
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const currentHour = currentTime.getHours();
|
|
129
|
+
const currentMinutes = currentTime.getMinutes();
|
|
130
|
+
const totalMinutes = currentHour * 60 + currentMinutes;
|
|
131
|
+
|
|
132
|
+
const elapsedMinutes = totalMinutes - startTime;
|
|
133
|
+
|
|
134
|
+
const adjustedMinutes = elapsedMinutes >= 0 ? (elapsedMinutes <= endTime - startTime ? elapsedMinutes : elapsedMinutes % (24 * 60)) : 0;
|
|
135
|
+
|
|
136
|
+
const progress = (adjustedMinutes / (endTime - startTime)) * 100; // Usar el rango de 8 a 18 horas
|
|
137
|
+
|
|
138
|
+
const formatDate = (date: Date | null): string => {
|
|
139
|
+
if (!date) {
|
|
140
|
+
// Si la fecha es null, muestra la fecha actual
|
|
141
|
+
const currentDate = new Date();
|
|
142
|
+
const options: Intl.DateTimeFormatOptions = {
|
|
143
|
+
day: 'numeric',
|
|
144
|
+
month: 'short',
|
|
145
|
+
year: 'numeric',
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
return currentDate.toLocaleDateString('es-ES', options).replace('.', '');
|
|
149
|
+
}
|
|
150
|
+
const options: Intl.DateTimeFormatOptions = {
|
|
151
|
+
day: 'numeric',
|
|
152
|
+
month: 'short',
|
|
153
|
+
year: 'numeric',
|
|
154
|
+
};
|
|
155
|
+
return date.toLocaleDateString('es-ES', options).replace('.', '');
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
// Filtrar los turnos cuando cambia el estado
|
|
160
|
+
const filterShifts = (turnos: IShifts[], estado: string | null) => {
|
|
161
|
+
switch (estado) {
|
|
162
|
+
case 'Presente':
|
|
163
|
+
return turnos.filter(turno => turno.status === 'Presente');
|
|
164
|
+
case 'Ausente':
|
|
165
|
+
return turnos.filter(turno => turno.status === 'Ausente');
|
|
166
|
+
case 'Atendido':
|
|
167
|
+
return turnos.filter(turno => turno.status === 'Atendido');
|
|
168
|
+
default:
|
|
169
|
+
return turnos;
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const shiftsFiltered = filterShifts(turnos, filterState);
|
|
174
|
+
shiftsfilteredref.current = shiftsFiltered;
|
|
175
|
+
|
|
176
|
+
// Calcular la cantidad por estado y total
|
|
177
|
+
let present = 0;
|
|
178
|
+
let missing = 0;
|
|
179
|
+
let catered = 0;
|
|
180
|
+
|
|
181
|
+
turnos?.forEach(turno => {
|
|
182
|
+
switch (turno.status) {
|
|
183
|
+
case 'Presente':
|
|
184
|
+
present += 1;
|
|
185
|
+
break;
|
|
186
|
+
case 'Ausente':
|
|
187
|
+
missing += 1;
|
|
188
|
+
break;
|
|
189
|
+
case 'Atendido':
|
|
190
|
+
catered += 1;
|
|
191
|
+
break;
|
|
192
|
+
default:
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
setquantitypresent(present);
|
|
198
|
+
setquantitymissing(missing);
|
|
199
|
+
setquantitycatered(catered);
|
|
200
|
+
settotalQuantity(turnos.length);
|
|
201
|
+
}, [turnos, filterState]);
|
|
202
|
+
|
|
203
|
+
const addshiftInCurrentSchedule = (hour: number, minute: string) => {
|
|
204
|
+
const shiftInCurrentSchedule = shiftsfilteredref.current.find(item => item.hour === hour && item.minute === minute);
|
|
205
|
+
|
|
206
|
+
if (shiftInCurrentSchedule) {
|
|
207
|
+
return (
|
|
208
|
+
<div
|
|
209
|
+
key={`${hour}:${minute}`}
|
|
210
|
+
className="completediary__item is-flex is-align-items-center is-gap-5"
|
|
211
|
+
style={{backgroundColor: shiftInCurrentSchedule.colorBackground}}
|
|
212
|
+
>
|
|
213
|
+
<div className="container is-flex is-fullw">
|
|
214
|
+
<div className="info has-text-weight-semibold is-fullw">{shiftInCurrentSchedule.name}</div>
|
|
215
|
+
<div className="info is-fullw">{shiftInCurrentSchedule.cuit}</div>
|
|
216
|
+
<div
|
|
217
|
+
className="info completediary__status is-flex is-align-items-center"
|
|
218
|
+
style={{backgroundColor: shiftInCurrentSchedule.colorBackgroundState}}
|
|
219
|
+
>
|
|
220
|
+
<Icon icon="fa-solid fa-circle" color={shiftInCurrentSchedule.iconColor} className="mr-2 is-size-7" />
|
|
221
|
+
<p className="has-text-light is-size-7">{shiftInCurrentSchedule.status}</p>
|
|
222
|
+
</div>
|
|
223
|
+
</div>
|
|
224
|
+
|
|
225
|
+
<div className="completediary__buttons is-flex is-align-items-center is-gap-4">
|
|
226
|
+
<div>
|
|
227
|
+
<Button
|
|
228
|
+
label="Cancelar"
|
|
229
|
+
fill="outline"
|
|
230
|
+
icon="fa-solid fa-xmark"
|
|
231
|
+
color="secondary"
|
|
232
|
+
trailingIcon={true}
|
|
233
|
+
className={`is-size-7 ${shiftInCurrentSchedule.showButton ? '' : 'is-invisible'}`}
|
|
234
|
+
onClick={() => onCancel && onCancel()}
|
|
235
|
+
/>
|
|
236
|
+
</div>
|
|
237
|
+
<div>
|
|
238
|
+
<Button
|
|
239
|
+
label="Atender"
|
|
240
|
+
fill="solid"
|
|
241
|
+
icon="fa-solid fa-arrow-right-to-bracket"
|
|
242
|
+
trailingIcon={true}
|
|
243
|
+
className={`is-size-7 ${shiftInCurrentSchedule.showButton ? '' : 'is-invisible'}`}
|
|
244
|
+
onClick={() => onAttend && onAttend()}
|
|
245
|
+
/>
|
|
246
|
+
</div>
|
|
247
|
+
<div
|
|
248
|
+
ref={menuDropRef}
|
|
249
|
+
className="is-relative"
|
|
250
|
+
onClick={() => {
|
|
251
|
+
setMenuExpanded(!menuExpanded);
|
|
252
|
+
onEllipse && onEllipse();
|
|
253
|
+
}}
|
|
254
|
+
>
|
|
255
|
+
<Icon
|
|
256
|
+
icon="fa-solid fa-ellipsis-vertical"
|
|
257
|
+
className={`icon_ellipsis ${shiftInCurrentSchedule.showButton ? '' : 'is-invisible'}`}
|
|
258
|
+
/>
|
|
259
|
+
{shiftInCurrentSchedule.menuDropComponent && menuExpanded && (
|
|
260
|
+
<div className="completediary__dropComponent is-absolute">{shiftInCurrentSchedule.menuDropComponent}</div>
|
|
261
|
+
)}
|
|
262
|
+
</div>
|
|
263
|
+
</div>
|
|
264
|
+
</div>
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
return <div style={{backgroundColor: '#CED4DA4D', height: '69px', borderRadius: '4px', border: '1px solid #E5E5E5'}}></div>;
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
return (
|
|
271
|
+
<div className="elv-component elv-completediary">
|
|
272
|
+
<div className={['completediary__head is-flex is-flex-direction-column is-gap-5', `${className ? ' ' + className : ''}`].join('')}>
|
|
273
|
+
{showDiary && <div className="has-text-grey-dark has-text-weight-bold is-size-3">{title}</div>}
|
|
274
|
+
|
|
275
|
+
<div className="completediary__head--breakpoint is-flex is-align-items-center is-justify-content-space-between ">
|
|
276
|
+
<div className="is-flex is-align-items-center is-gap-4">
|
|
277
|
+
<p className="is-size-7 has-text-weight-medium">{changeDate}</p>
|
|
278
|
+
<div>
|
|
279
|
+
<DatePicker
|
|
280
|
+
selected={selectedDate}
|
|
281
|
+
onChange={(date: Date | null) => {
|
|
282
|
+
setSelectedDate(date), onDate && onDate(date);
|
|
283
|
+
}}
|
|
284
|
+
customInput={
|
|
285
|
+
<div className="is-flex datePickerStyles">
|
|
286
|
+
<span className="has-text-grey-dark">{formatDate(selectedDate)}</span>
|
|
287
|
+
<Icon icon="fa-solid fa-chevron-up" className={`ml-3 rotateIcon `} />
|
|
288
|
+
</div>
|
|
289
|
+
}
|
|
290
|
+
/>
|
|
291
|
+
</div>
|
|
292
|
+
</div>
|
|
293
|
+
<div className="completediary__head__filters is-flex is-align-items-center is-size-7 is-gap-4">
|
|
294
|
+
<div className={`completediary__head__filter ${filterState === null ? 'filter' : ''}`} onClick={() => setfilterState(null)}>
|
|
295
|
+
{`${labelAll} (${totalQuantity})`}
|
|
296
|
+
</div>
|
|
297
|
+
<div
|
|
298
|
+
className={`completediary__head__filter ${filterState === 'Presente' ? 'filter' : ''}`}
|
|
299
|
+
onClick={() => setfilterState('Presente')}
|
|
300
|
+
>
|
|
301
|
+
{`${labelPresent} (${quantitypresent})`}
|
|
302
|
+
</div>
|
|
303
|
+
<div
|
|
304
|
+
className={`completediary__head__filter ${filterState === 'Ausente' ? 'filter' : ''}`}
|
|
305
|
+
onClick={() => setfilterState('Ausente')}
|
|
306
|
+
>
|
|
307
|
+
{`${labelMissing} (${quantitymissing})`}
|
|
308
|
+
</div>
|
|
309
|
+
<div
|
|
310
|
+
className={`completediary__head__filter ${filterState === 'Atendido' ? 'filter' : ''}`}
|
|
311
|
+
onClick={() => setfilterState('Atendido')}
|
|
312
|
+
>
|
|
313
|
+
{`${labelCatered} (${quantitycatered})`}
|
|
314
|
+
</div>
|
|
315
|
+
</div>
|
|
316
|
+
</div>
|
|
317
|
+
<div className="completediary is-flex px-5 pt-5 is-flex-direction-column box">
|
|
318
|
+
<div className="container is-flex is-size-7 has-text-grey-dark m-0 is-align-items-center is-justify-content-space-around">
|
|
319
|
+
<div className="completediary__label">{labelName}</div>
|
|
320
|
+
<div className="completediary__label">{labelCuit}</div>
|
|
321
|
+
<div className="completediary__label is-flex is-align-items-center">
|
|
322
|
+
<p className="completediary__statu">{labelStatus}</p>
|
|
323
|
+
<div
|
|
324
|
+
ref={tooltipMenuRef}
|
|
325
|
+
className="completediary__icontooltip is-relative"
|
|
326
|
+
onClick={() => {
|
|
327
|
+
setExpandedTooltip(!expandedTooltip);
|
|
328
|
+
}}
|
|
329
|
+
>
|
|
330
|
+
<Icon icon="fa-solid fa-circle-info" className="iconState ml-2 completediary__label" />
|
|
331
|
+
{expandedTooltip && (
|
|
332
|
+
<Tooltip active contentType="text" text={iconText} trianglePos="none" className="completediary__tooltip is-absolute" />
|
|
333
|
+
)}
|
|
334
|
+
</div>
|
|
335
|
+
</div>
|
|
336
|
+
</div>
|
|
337
|
+
|
|
338
|
+
<div className="completediary__time time-bar is-flex is-flex-direction-column is-align-items-center is-fullw is-relative">
|
|
339
|
+
<div className="time-range is-flex is-flex-direction-column-reverse is-size-7 has-text-weight-semibold is-gap-4 is-fullw">
|
|
340
|
+
{Array.from({length: 22}, (_, index) => {
|
|
341
|
+
const hour = Math.floor(index / 2) + 8;
|
|
342
|
+
const minute = index % 2 === 0 ? '00' : '30';
|
|
343
|
+
const showTime =
|
|
344
|
+
hour < 18 || (hour === 18 && minute === '00') || (hour === 8 && minute === '00' && elapsedMinutes >= 24 * 60);
|
|
345
|
+
|
|
346
|
+
// Crear un objeto Date para el tiempo actual
|
|
347
|
+
const currentTime = new Date();
|
|
348
|
+
currentTime.setHours(hour, parseInt(minute));
|
|
349
|
+
|
|
350
|
+
// Verificar si el tiempo actual está dentro del horario de descanso
|
|
351
|
+
const restSchedule = currentTime >= scheduleRest.start && currentTime < scheduleRest.end;
|
|
352
|
+
|
|
353
|
+
// Mostrar el espacio de descanso en lugar de los turnos si es un horario de descanso
|
|
354
|
+
if (restSchedule) {
|
|
355
|
+
return (
|
|
356
|
+
showTime &&
|
|
357
|
+
hour < 18 && (
|
|
358
|
+
<div key={index} className="time-label is-flex is-gap-4">
|
|
359
|
+
<span className="time" style={{color: '#16A34A'}}>{`${hour}:${minute} h`}</span>
|
|
360
|
+
<div className="is-fullw">
|
|
361
|
+
<div style={{backgroundColor: '#ECFDF5', height: '66px', borderRadius: '4px', border: '1px solid #E5E5E5'}}></div>
|
|
362
|
+
</div>
|
|
363
|
+
</div>
|
|
364
|
+
)
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
const turnosEnHorario = shiftsfilteredref.current.filter(turno => turno.hour === hour && turno.minute === minute);
|
|
369
|
+
|
|
370
|
+
return (
|
|
371
|
+
// Mostrar solo las horas hasta las 18:00
|
|
372
|
+
showTime &&
|
|
373
|
+
hour < 18 && (
|
|
374
|
+
<div key={index} className="time-label is-flex is-gap-4 ">
|
|
375
|
+
<span className="time">{`${hour}:${minute} h`}</span>
|
|
376
|
+
<div className={`is-fullw`}> {addshiftInCurrentSchedule(hour, minute)}</div>
|
|
377
|
+
</div>
|
|
378
|
+
)
|
|
379
|
+
);
|
|
380
|
+
}).reverse()}
|
|
381
|
+
</div>
|
|
382
|
+
<div
|
|
383
|
+
className="current-time is-flex is-absolute is-align-items-center is-justify-content-center"
|
|
384
|
+
style={{top: `${Math.max(0, Math.min(progress, 100))}%`}}
|
|
385
|
+
>
|
|
386
|
+
{/* <span>{formatTime(currentTime)}</span> */}
|
|
387
|
+
<Icon icon="fa-solid fa-circle" className="icon-time is-absolute" />
|
|
388
|
+
</div>
|
|
389
|
+
</div>
|
|
390
|
+
</div>
|
|
391
|
+
</div>
|
|
392
|
+
</div>
|
|
393
|
+
);
|
|
394
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
@import '/src/sass/utilities/variables';
|
|
2
|
+
|
|
3
|
+
.elv-dropdown {
|
|
4
|
+
.e-dropdown {
|
|
5
|
+
min-width: 250px;
|
|
6
|
+
max-width: max-content;
|
|
7
|
+
box-shadow: 0px 14px 24px rgba(20, 23, 38, 0.12);
|
|
8
|
+
border-radius: 16px;
|
|
9
|
+
z-index: 100;
|
|
10
|
+
|
|
11
|
+
display: none;
|
|
12
|
+
|
|
13
|
+
position: absolute;
|
|
14
|
+
top: 100%;
|
|
15
|
+
|
|
16
|
+
&--left {
|
|
17
|
+
left: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&--center {
|
|
21
|
+
left: 50%;
|
|
22
|
+
transform: translateX(-50%);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&--right {
|
|
26
|
+
right: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&--active {
|
|
30
|
+
display: block;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.dropdown__list {
|
|
34
|
+
list-style: none;
|
|
35
|
+
font-weight: $fw-semibold;
|
|
36
|
+
color: $text-900;
|
|
37
|
+
|
|
38
|
+
.list__item {
|
|
39
|
+
border-radius: 15px;
|
|
40
|
+
gap: 10px;
|
|
41
|
+
|
|
42
|
+
&--active {
|
|
43
|
+
background-color: $muted-300;
|
|
44
|
+
|
|
45
|
+
.item__icon {
|
|
46
|
+
color: $primary-600;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&--default {
|
|
51
|
+
color: $text-500;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&:hover {
|
|
55
|
+
background-color: $muted-300;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {ComponentStory, ComponentMeta} from '@storybook/react';
|
|
2
|
+
import {Dropdown} from './Dropdown';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Elements/Dropdown',
|
|
6
|
+
component: Dropdown,
|
|
7
|
+
args: {
|
|
8
|
+
position: 'left',
|
|
9
|
+
options: [{label: 'Opcion 1', icon: {icon: 'fas fa-user'}}, {label: 'Opcion 2'}, {label: 'Opcion 3'}],
|
|
10
|
+
},
|
|
11
|
+
} as ComponentMeta<typeof Dropdown>;
|
|
12
|
+
|
|
13
|
+
const Template: ComponentStory<typeof Dropdown> = args => <Dropdown {...args} />;
|
|
14
|
+
|
|
15
|
+
export const Standard = Template.bind({});
|
|
16
|
+
Standard.args = {trigger: {label: 'Trigger'}};
|
|
17
|
+
|
|
18
|
+
export const NoTrigger = Template.bind({});
|
|
19
|
+
NoTrigger.args = {visible: false};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import {useEffect, useRef, useState} from 'react';
|
|
2
|
+
import {Button, IButton} from '../../Elements/Button/Button';
|
|
3
|
+
import {Icon, IIcon} from '../../Elements/Icon/Icon';
|
|
4
|
+
import './Dropdown.scss';
|
|
5
|
+
import {generateRandomKey} from '../../../utils/functions';
|
|
6
|
+
|
|
7
|
+
export interface IDropdown extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
|
|
8
|
+
// base
|
|
9
|
+
trigger?: IButton;
|
|
10
|
+
options?: {label: string; icon?: IIcon; onClick?: () => void}[];
|
|
11
|
+
position?: 'left' | 'center' | 'right';
|
|
12
|
+
|
|
13
|
+
// boolean
|
|
14
|
+
visible?: boolean;
|
|
15
|
+
|
|
16
|
+
// events
|
|
17
|
+
onClick?: () => void;
|
|
18
|
+
|
|
19
|
+
// react
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const Dropdown = ({trigger, options, position, visible, className, onClick, ...props}: IDropdown) => {
|
|
24
|
+
const [activeState, setActiveState] = useState(visible ? visible : false);
|
|
25
|
+
|
|
26
|
+
// =============================== REF USER ===============================
|
|
27
|
+
const dropRef = useRef<HTMLDivElement>(null);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
function handleClickOutside(event: MouseEvent) {
|
|
30
|
+
if (dropRef.current && !dropRef.current.contains(event.target as Node)) {
|
|
31
|
+
setActiveState(false);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
document.addEventListener('click', handleClickOutside);
|
|
36
|
+
|
|
37
|
+
return () => {
|
|
38
|
+
document.removeEventListener('click', handleClickOutside);
|
|
39
|
+
};
|
|
40
|
+
}, [dropRef]);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div className="elv-component elv-dropdown" {...props}>
|
|
44
|
+
{trigger ? (
|
|
45
|
+
<div className="is-relative is-inline-block" ref={dropRef}>
|
|
46
|
+
<Button
|
|
47
|
+
{...trigger}
|
|
48
|
+
onClick={() => {
|
|
49
|
+
setActiveState(!activeState);
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
52
|
+
<div
|
|
53
|
+
className={[
|
|
54
|
+
`e-dropdown has-background-white`,
|
|
55
|
+
`${activeState ? ' e-dropdown--active' : ''}`,
|
|
56
|
+
`${position ? ' e-dropdown--' + position : ''}`,
|
|
57
|
+
`${className ? ' ' + className : ''}`,
|
|
58
|
+
].join('')}
|
|
59
|
+
>
|
|
60
|
+
<ul className={['dropdown__list', ' has-text-weight-semibold', ' p-1'].join('')}>
|
|
61
|
+
{options?.map((item, index) => (
|
|
62
|
+
<li
|
|
63
|
+
key={index + generateRandomKey()}
|
|
64
|
+
className={[`list__item`, ` is-clickable`, ' is-flex is-align-items-center', ' py-4 px-2'].join('')}
|
|
65
|
+
onClick={() => item.onClick && item.onClick()}
|
|
66
|
+
>
|
|
67
|
+
{item.icon && <Icon {...item.icon} />}
|
|
68
|
+
{item.label}
|
|
69
|
+
</li>
|
|
70
|
+
))}
|
|
71
|
+
</ul>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
) : (
|
|
75
|
+
<div
|
|
76
|
+
className={[
|
|
77
|
+
`e-dropdown has-background-white`,
|
|
78
|
+
`${visible ? ' e-dropdown--active' : ''}`,
|
|
79
|
+
`${position ? ' e-dropdown--' + position : ''}`,
|
|
80
|
+
`${className ? ' ' + className : ''}`,
|
|
81
|
+
].join('')}
|
|
82
|
+
>
|
|
83
|
+
<ul className="dropdown__list p-1">
|
|
84
|
+
{options?.map((item, index) => (
|
|
85
|
+
<li
|
|
86
|
+
key={index}
|
|
87
|
+
className={[`list__item`, ` is-clickable`, ' is-flex is-align-items-center', ' py-4 px-2'].join('')}
|
|
88
|
+
onClick={() => item.onClick && item.onClick()}
|
|
89
|
+
>
|
|
90
|
+
{item.icon && <Icon {...item.icon} />}
|
|
91
|
+
{item.label}
|
|
92
|
+
</li>
|
|
93
|
+
))}
|
|
94
|
+
</ul>
|
|
95
|
+
</div>
|
|
96
|
+
)}
|
|
97
|
+
</div>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {ComponentStory, ComponentMeta} from '@storybook/react';
|
|
3
|
+
import {EmptyState} from './EmptyState';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/EmptyState',
|
|
7
|
+
component: EmptyState,
|
|
8
|
+
args: {
|
|
9
|
+
orientation: 'horizontal',
|
|
10
|
+
img: 'https://image.shutterstock.com/image-vector/electric-power-plug-holding-hand-260nw-530773483.jpg',
|
|
11
|
+
error: 'Error 404',
|
|
12
|
+
title: 'No podemos realizar la acción que intentas hacer',
|
|
13
|
+
description:
|
|
14
|
+
'Amet minim mollit non deserunt ullamco est sit aliqua dolor do amet sint. Velit officia consequat duis enim velit mollit. Exercitation veniam consequat sunt nostrud amet.',
|
|
15
|
+
buttonsActive: false,
|
|
16
|
+
|
|
17
|
+
button: [
|
|
18
|
+
{
|
|
19
|
+
label: 'Button',
|
|
20
|
+
size: 'normal',
|
|
21
|
+
color: 'primary',
|
|
22
|
+
fill: 'solid',
|
|
23
|
+
loading: false,
|
|
24
|
+
disabled: false,
|
|
25
|
+
leadingIcon: false,
|
|
26
|
+
type: 'button',
|
|
27
|
+
onClick: () => console.log('Button Clicked'),
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
label: 'Button',
|
|
31
|
+
size: 'normal',
|
|
32
|
+
color: 'primary',
|
|
33
|
+
fill: 'link',
|
|
34
|
+
loading: false,
|
|
35
|
+
disabled: false,
|
|
36
|
+
type: 'button',
|
|
37
|
+
onClick: () => console.log('Button Clicked'),
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
} as ComponentMeta<typeof EmptyState>;
|
|
42
|
+
|
|
43
|
+
const Template: ComponentStory<typeof EmptyState> = args => <EmptyState {...args} />;
|
|
44
|
+
|
|
45
|
+
export const Standard = Template.bind({});
|
|
46
|
+
Standard.args = {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {shortenText} from '../../../utils/functions';
|
|
2
|
+
import './emptyState.scss';
|
|
3
|
+
import {Button, IButton} from '../../Elements/Button/Button';
|
|
4
|
+
|
|
5
|
+
export interface IEmptyState extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
|
|
6
|
+
// base
|
|
7
|
+
orientation: 'horizontal' | 'vertical';
|
|
8
|
+
img: string;
|
|
9
|
+
error: string;
|
|
10
|
+
title: string;
|
|
11
|
+
description: string;
|
|
12
|
+
button: IButton[];
|
|
13
|
+
|
|
14
|
+
// boolean
|
|
15
|
+
buttonsActive: boolean;
|
|
16
|
+
|
|
17
|
+
// react
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const EmptyState = ({orientation, img, error, title, description, className, buttonsActive, button, ...props}: IEmptyState) => {
|
|
22
|
+
return (
|
|
23
|
+
<div className={`elv-component elv-e-state ${className ? className : ''}`} {...props}>
|
|
24
|
+
<div className={`e-state ${orientation === 'vertical' ? 'e-state--vertical' : ''}`}>
|
|
25
|
+
<div className="e-state__img-container">
|
|
26
|
+
<img src={img} alt="" />
|
|
27
|
+
</div>
|
|
28
|
+
<div className="e-state__body">
|
|
29
|
+
<div className="text-container">
|
|
30
|
+
<p className="error">{error}</p>
|
|
31
|
+
<p className="title is-4">{title}</p>
|
|
32
|
+
<p className="description is-5">{description}</p>
|
|
33
|
+
</div>
|
|
34
|
+
{buttonsActive && (
|
|
35
|
+
<div className="buttons-container">
|
|
36
|
+
{button[0] && <Button isFullWidth={true} {...button[0]} />}
|
|
37
|
+
{button[1] && <Button isFullWidth={true} {...button[1]} />}
|
|
38
|
+
</div>
|
|
39
|
+
)}
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
};
|