@tmf_ciclica/ciclicastorybook 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/.storybook/main.js +21 -0
- package/.storybook/preview.jsx +31 -0
- package/README.md +8 -0
- package/eslint.config.js +38 -0
- package/index.html +13 -0
- package/package.json +67 -0
- package/public/vite.svg +1 -0
- package/src/App.css +0 -0
- package/src/App.jsx +36 -0
- package/src/_variables.scss +56 -0
- package/src/assets/img/arrowDown.svg +3 -0
- package/src/assets/img/closeIcon.svg +4 -0
- package/src/assets/img/copyIcon.svg +17 -0
- package/src/assets/img/deleteIcon.svg +6 -0
- package/src/assets/img/eyeActiveIcon.svg +6 -0
- package/src/assets/img/eyeNotActiveIcon.svg +8 -0
- package/src/assets/img/filtersIcon.svg +6 -0
- package/src/assets/img/langarrow.png +0 -0
- package/src/assets/img/pause.svg +5 -0
- package/src/assets/img/play.svg +4 -0
- package/src/assets/img/processingIcon.svg +20 -0
- package/src/assets/img/sample-image.png +0 -0
- package/src/assets/img/sample2.png +0 -0
- package/src/assets/img/world.svg +3 -0
- package/src/assets/mapStyles/mapStyle.js +781 -0
- package/src/components/AmbitSelector/AmbitItem/AmbitItem.jsx +74 -0
- package/src/components/AmbitSelector/AmbitItem/AmbitItem.module.scss +27 -0
- package/src/components/AmbitSelector/AmbitSelector.jsx +68 -0
- package/src/components/AmbitSelector/AmbitSelector.module.scss +29 -0
- package/src/components/AmbitSelector/AmbitSelector.stories.jsx +21 -0
- package/src/components/ButtonsList/ButtonsList.jsx +92 -0
- package/src/components/ButtonsList/ButtonsList.module.scss +37 -0
- package/src/components/ButtonsList/ButtonsList.stories.jsx +55 -0
- package/src/components/DropdownList/DropdownList.jsx +69 -0
- package/src/components/DropdownList/DropdownList.module.scss +20 -0
- package/src/components/DropdownList/DropdownList.stories.jsx +22 -0
- package/src/components/DropdownList/DropdownListExample/DropDownListExample.jsx +33 -0
- package/src/components/DropdownList/DropdownListExample/DropdownListExample.stories.jsx +11 -0
- package/src/components/EditAmbit/EditAmbit.jsx +7 -0
- package/src/components/FiltersAmbit/AppliedFilters/AppliedFilters.jsx +57 -0
- package/src/components/FiltersAmbit/AppliedFilters/AppliedFilters.module.scss +13 -0
- package/src/components/FiltersAmbit/AppliedFilters/AppliedFilters.stories.jsx +47 -0
- package/src/components/FiltersAmbit/FiltersAmbit.jsx +58 -0
- package/src/components/FiltersAmbit/FiltersAmbit.module.scss +28 -0
- package/src/components/FiltersAmbit/FiltersAmbit.stories.jsx +36 -0
- package/src/components/FiltersAmbit/GeographicFilters/GeographicalFilters.jsx +33 -0
- package/src/components/FiltersAmbit/GeographicFilters/GeographicalFilters.module.scss +13 -0
- package/src/components/FiltersAmbit/GeographicFilters/GeographicalFilters.stories.jsx +47 -0
- package/src/components/FiltersAmbit/TematicalFilters/TematicalFilters.jsx +83 -0
- package/src/components/FiltersAmbit/TematicalFilters/TematicalFilters.module.scss +8 -0
- package/src/components/FiltersAmbit/TematicalFilters/TematicalFilters.stories.jsx +17 -0
- package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersCategory/TematicalFiltersCategory.jsx +60 -0
- package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/AbsoluteSlider/AbsoluteSlider.jsx +61 -0
- package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/AbsoluteSlider/AbsoluteSlider.module.scss +45 -0
- package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/CategoryCheckbox/CategoryChackbox.module.scss +18 -0
- package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/CategoryCheckbox/CategoryCheckbox.jsx +47 -0
- package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/TematicalFiltersInput.jsx +267 -0
- package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/TematicalFiltersInput.module.scss +31 -0
- package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersSubcat/TematicalFiltersSubcat.jsx +58 -0
- package/src/components/FiltersAmbit/useAmbitStore.jsx +10 -0
- package/src/components/Graphic/BarChart/BarChart.jsx +146 -0
- package/src/components/Graphic/BarChart/BarChart.module.scss +5 -0
- package/src/components/Graphic/BarChart/BarChart.stories.jsx +18 -0
- package/src/components/Graphic/Graphic.jsx +55 -0
- package/src/components/Graphic/Graphic.module.scss +12 -0
- package/src/components/Graphic/Graphic.stories.jsx +25 -0
- package/src/components/IndicatorsList/Indicator/Indicator.jsx +180 -0
- package/src/components/IndicatorsList/Indicator/Indicator.module.scss +46 -0
- package/src/components/IndicatorsList/IndicatorSubCategory/IndicatorSubCategory.jsx +76 -0
- package/src/components/IndicatorsList/IndicatorSubCategory/IndicatorSubCategory.module.scss +12 -0
- package/src/components/IndicatorsList/IndicatorsCategory/IndicatorsCategory.jsx +122 -0
- package/src/components/IndicatorsList/IndicatorsCategory/IndicatorsCategory.module.scss +20 -0
- package/src/components/IndicatorsList/IndicatorsList.jsx +173 -0
- package/src/components/IndicatorsList/IndicatorsList.module.scss +10 -0
- package/src/components/IndicatorsList/IndicatorsList.stories.jsx +263 -0
- package/src/components/LangSelector/LangSelector.jsx +70 -0
- package/src/components/LangSelector/LangSelector.module.scss +41 -0
- package/src/components/LangSelector/LangSelector.stories.jsx +27 -0
- package/src/components/Legend/Legend.jsx +132 -0
- package/src/components/Legend/Legend.module.scss +121 -0
- package/src/components/Legend/Legend.stories.jsx +53 -0
- package/src/components/LogoApp/LogoApp.jsx +33 -0
- package/src/components/LogoApp/LogoApp.module.scss +7 -0
- package/src/components/LogoApp/LogoApp.stories.jsx +27 -0
- package/src/components/MapboxMap/MapboxMap.jsx +160 -0
- package/src/components/MapboxMap/MapboxMap.module.scss +4 -0
- package/src/components/MapboxMap/MapboxMap.stories.jsx +57 -0
- package/src/components/MaplibreMap/MaplibreMap.jsx +166 -0
- package/src/components/MaplibreMap/MaplibreMap.module.scss +5 -0
- package/src/components/MaplibreMap/MaplibreMap.stories.jsx +55 -0
- package/src/components/SectionBar/SectionBar.jsx +41 -0
- package/src/components/SectionBar/SectionBar.module.scss +40 -0
- package/src/components/SectionBar/SectionBar.stories.jsx +35 -0
- package/src/components/TimeSlider/TimeSlider.jsx +147 -0
- package/src/components/TimeSlider/TimeSlider.module.scss +63 -0
- package/src/components/TimeSlider/TimeSlider.stories.jsx +9 -0
- package/src/components/Tooltip/Tooltip.jsx +40 -0
- package/src/components/Tooltip/Tooltip.module.scss +141 -0
- package/src/components/Tooltip/Tooltip.stories.jsx +51 -0
- package/src/components/TopNavMenu/TopNavMenu.jsx +62 -0
- package/src/components/TopNavMenu/TopNavMenu.module.scss +21 -0
- package/src/components/TopNavMenu/TopNavMenu.stories.jsx +20 -0
- package/src/components/UserMenuTrigger/UserMenuTrigger.jsx +47 -0
- package/src/components/UserMenuTrigger/UserMenuTrigger.module.scss +5 -0
- package/src/components/UserMenuTrigger/UserMenuTrigger.stories.jsx +33 -0
- package/src/components/index.jsx +17 -0
- package/src/constants/indicators.js +1371 -0
- package/src/constants/mapTexts.js +161 -0
- package/src/constants/textLayers.js +639 -0
- package/src/constants/topNavMenuOptions.js +14 -0
- package/src/i18n.js +19 -0
- package/src/index.js +2 -0
- package/src/index.scss +87 -0
- package/src/locales/ca.json +8 -0
- package/src/locales/es.json +15 -0
- package/src/main.jsx +10 -0
- package/src/sections/HeaderSection/HeaderSection.jsx +51 -0
- package/src/sections/HeaderSection/HeaderSection.module.scss +33 -0
- package/src/sections/HeaderSection/HeaderSection.stories.jsx +61 -0
- package/src/sections/RightSidebar/RightSidebar.jsx +35 -0
- package/src/sections/RightSidebar/RightSidebar.module.scss +39 -0
- package/src/sections/RightSidebar/RightSidebar.stories.jsx +21 -0
- package/src/sections/index.js +2 -0
- package/src/store/index.js +1 -0
- package/src/store/mapSlice/index.js +1 -0
- package/src/store/mapSlice/mapSlice.js +30 -0
- package/src/store/rightBarSlice/index.js +1 -0
- package/src/store/rightBarSlice/rightBarSlice.js +28 -0
- package/src/store/routerSlice/index.js +1 -0
- package/src/store/routerSlice/routerSlice.js +14 -0
- package/src/store/store.js +14 -0
- package/src/store/userSlice/index.js +1 -0
- package/src/store/userSlice/userSlice.js +22 -0
- package/vite.config.js +36 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { IndicatorsList } from "./IndicatorsList"
|
|
2
|
+
import Indicadores from "../../constants/indicators"
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/IndicatorsList",
|
|
5
|
+
component: IndicatorsList,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const Default = {
|
|
9
|
+
args: {
|
|
10
|
+
indicators: Indicadores,
|
|
11
|
+
// activeColor: "#f75321",
|
|
12
|
+
activeColor: "#F8A925",
|
|
13
|
+
defaultColor: "#605B56",
|
|
14
|
+
multiple: false,
|
|
15
|
+
onChange: (indicator) => {
|
|
16
|
+
console.log("onChange indicators: ", indicator)
|
|
17
|
+
},
|
|
18
|
+
defaultValue: {
|
|
19
|
+
ikey: 0, //ikey asociada al indicador
|
|
20
|
+
name: "indicators.us_prn.title", //título del indicador referenciado al archivo locales (traducción)
|
|
21
|
+
code: ["us_prn"], //código del indicador en el archivo json de las tiles
|
|
22
|
+
type: "cat", //tipo del indicador. Puede ser-> 'cat' (categorizado), 'abs' (valor absoluto), 'both' (indicador con las dos opciones), 'twoUnits' (indicator abs con 2 unidades distintas)
|
|
23
|
+
category: "Arq", //ERESE: Categoria a la que pertenece el indicador. Puede ser -> 'Arq' (Arquitectónica), 'Ene' (Energética), 'Eco' (Económica), 'Ide' (Identificación).
|
|
24
|
+
category_ods: "ODS_00", //ODS:
|
|
25
|
+
category_aue: "AUE_00", //AUE:
|
|
26
|
+
values: [
|
|
27
|
+
//por cada uno de los posibles valores o categorías creamos un objeto con el color asociado, el código o códigos (array) del archivo tiles y su título (referencia a locales)
|
|
28
|
+
{
|
|
29
|
+
fillColor: "#FEB740",
|
|
30
|
+
codename: ["Residencial", "VincViv"],
|
|
31
|
+
title: "indicators.us_prn.Residencial",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
fillColor: "#033364",
|
|
35
|
+
codename: ["Público"],
|
|
36
|
+
title: "indicators.us_prn.Public",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
fillColor: "#5190cb",
|
|
40
|
+
codename: ["EnseñanzaCultural"],
|
|
41
|
+
title: "indicators.us_prn.EnsenyamentCultural",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
fillColor: "#18ae9a",
|
|
45
|
+
codename: ["Deportivo", "Piscinas"],
|
|
46
|
+
title: "indicators.us_prn.Esportiu",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
fillColor: "#850d15",
|
|
50
|
+
codename: ["Comercial"],
|
|
51
|
+
title: "indicators.us_prn.Comercial",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
fillColor: "#ee2e39",
|
|
55
|
+
codename: ["HoteleroRestauración"],
|
|
56
|
+
title: "indicators.us_prn.HotelerRestauracio",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
fillColor: "#ed602e",
|
|
60
|
+
codename: ["Oficinas"],
|
|
61
|
+
title: "indicators.us_prn.Oficines",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
fillColor: "#843059",
|
|
65
|
+
codename: ["Almacenaje"],
|
|
66
|
+
title: "indicators.us_prn.Emmagatzematge",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
fillColor: "#CB719D",
|
|
70
|
+
codename: ["Industrial", "IndustrialResto"],
|
|
71
|
+
title: "indicators.us_prn.Industrial",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
fillColor: "#7f7f7f",
|
|
75
|
+
codename: ["Aparcamiento"],
|
|
76
|
+
title: "indicators.us_prn.Aparcament",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
fillColor: "#dadae3",
|
|
80
|
+
codename: [
|
|
81
|
+
"OtrosCal",
|
|
82
|
+
"OtrosNoCal",
|
|
83
|
+
"Común",
|
|
84
|
+
"Sin datos",
|
|
85
|
+
"",
|
|
86
|
+
"None",
|
|
87
|
+
"null",
|
|
88
|
+
"undefined",
|
|
89
|
+
" ",
|
|
90
|
+
"NoCodificado",
|
|
91
|
+
],
|
|
92
|
+
title: "indicators.us_prn.None",
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
time: false,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export const Multiple = {
|
|
101
|
+
args: {
|
|
102
|
+
indicators: Indicadores,
|
|
103
|
+
// activeColor: "#f75321",
|
|
104
|
+
activeColor: "#F8A925",
|
|
105
|
+
defaultColor: "#605B56",
|
|
106
|
+
multiple: true,
|
|
107
|
+
onChange: (indicator) => {
|
|
108
|
+
console.log("onChange indicators: ", indicator)
|
|
109
|
+
},
|
|
110
|
+
defaultValue: [
|
|
111
|
+
{
|
|
112
|
+
ikey: 6,
|
|
113
|
+
name: "indicators.cal.title",
|
|
114
|
+
code: ["demanda_cal_m2"],
|
|
115
|
+
type: "abs",
|
|
116
|
+
category: "Ene",
|
|
117
|
+
category_ods: "ODS_07",
|
|
118
|
+
category_aue: "AUE_04",
|
|
119
|
+
maxColor: "#EE2C3C",
|
|
120
|
+
midColor: "#FDB740",
|
|
121
|
+
minColor: "#00544A",
|
|
122
|
+
minValue: 1,
|
|
123
|
+
maxValue: 120,
|
|
124
|
+
minValueIndicador: "indicators.cal.minValueIndicador",
|
|
125
|
+
maxValueIndicador: "indicators.cal.maxValueIndicador",
|
|
126
|
+
unit: "indicators.cal.unit",
|
|
127
|
+
time: true,
|
|
128
|
+
values: [
|
|
129
|
+
{
|
|
130
|
+
fillColor: "#00544A",
|
|
131
|
+
codename: ["Menos de 20 kWh/m2"],
|
|
132
|
+
title: "indicators.demanda_cal_m2.<20",
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
fillColor: "#386A48",
|
|
136
|
+
codename: ["Entre 20 y 40 kWh/m2"],
|
|
137
|
+
title: "indicators.demanda_cal_m2.20-40",
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
fillColor: "#708046",
|
|
141
|
+
codename: ["Entre 40 y 60 kWh/m2"],
|
|
142
|
+
title: "indicators.demanda_cal_m2.40-60",
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
fillColor: "#A99643",
|
|
146
|
+
codename: ["Entre 60 y 80 kWh/m2"],
|
|
147
|
+
title: "indicators.demanda_cal_m2.60-80",
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
fillColor: "#E1AC41",
|
|
151
|
+
codename: ["Entre 80 y 100 kWh/m2"],
|
|
152
|
+
title: "indicators.demanda_cal_m2.80-100",
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
fillColor: "#FBA840",
|
|
156
|
+
codename: ["Entre 100 y 120 kWh/m2"],
|
|
157
|
+
title: "indicators.demanda_cal_m2.100-120",
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
fillColor: "#F8893F",
|
|
161
|
+
codename: ["Entre 120 y 140 kWh/m2"],
|
|
162
|
+
title: "indicators.demanda_cal_m2.120-140",
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
fillColor: "#F56A3E",
|
|
166
|
+
codename: ["Entre 140 y 160 kWh/m2"],
|
|
167
|
+
title: "indicators.demanda_cal_m2.140-160",
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
fillColor: "#F14B3D",
|
|
171
|
+
codename: ["Entre 160 y 180 kWh/m2"],
|
|
172
|
+
title: "indicators.demanda_cal_m2.160-180",
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
fillColor: "#EE2C3C",
|
|
176
|
+
codename: ["Más de 180 kWh/m2"],
|
|
177
|
+
title: "indicators.demanda_cal_m2.>180",
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
{
|
|
183
|
+
ikey: 0, //ikey asociada al indicador
|
|
184
|
+
name: "indicators.us_prn.title", //título del indicador referenciado al archivo locales (traducción)
|
|
185
|
+
code: ["us_prn"], //código del indicador en el archivo json de las tiles
|
|
186
|
+
type: "cat", //tipo del indicador. Puede ser-> 'cat' (categorizado), 'abs' (valor absoluto), 'both' (indicador con las dos opciones), 'twoUnits' (indicator abs con 2 unidades distintas)
|
|
187
|
+
category: "Arq", //ERESE: Categoria a la que pertenece el indicador. Puede ser -> 'Arq' (Arquitectónica), 'Ene' (Energética), 'Eco' (Económica), 'Ide' (Identificación).
|
|
188
|
+
category_ods: "ODS_00", //ODS:
|
|
189
|
+
category_aue: "AUE_00", //AUE:
|
|
190
|
+
values: [
|
|
191
|
+
//por cada uno de los posibles valores o categorías creamos un objeto con el color asociado, el código o códigos (array) del archivo tiles y su título (referencia a locales)
|
|
192
|
+
{
|
|
193
|
+
fillColor: "#FEB740",
|
|
194
|
+
codename: ["Residencial", "VincViv"],
|
|
195
|
+
title: "indicators.us_prn.Residencial",
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
fillColor: "#033364",
|
|
199
|
+
codename: ["Público"],
|
|
200
|
+
title: "indicators.us_prn.Public",
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
fillColor: "#5190cb",
|
|
204
|
+
codename: ["EnseñanzaCultural"],
|
|
205
|
+
title: "indicators.us_prn.EnsenyamentCultural",
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
fillColor: "#18ae9a",
|
|
209
|
+
codename: ["Deportivo", "Piscinas"],
|
|
210
|
+
title: "indicators.us_prn.Esportiu",
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
fillColor: "#850d15",
|
|
214
|
+
codename: ["Comercial"],
|
|
215
|
+
title: "indicators.us_prn.Comercial",
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
fillColor: "#ee2e39",
|
|
219
|
+
codename: ["HoteleroRestauración"],
|
|
220
|
+
title: "indicators.us_prn.HotelerRestauracio",
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
fillColor: "#ed602e",
|
|
224
|
+
codename: ["Oficinas"],
|
|
225
|
+
title: "indicators.us_prn.Oficines",
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
fillColor: "#843059",
|
|
229
|
+
codename: ["Almacenaje"],
|
|
230
|
+
title: "indicators.us_prn.Emmagatzematge",
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
fillColor: "#CB719D",
|
|
234
|
+
codename: ["Industrial", "IndustrialResto"],
|
|
235
|
+
title: "indicators.us_prn.Industrial",
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
fillColor: "#7f7f7f",
|
|
239
|
+
codename: ["Aparcamiento"],
|
|
240
|
+
title: "indicators.us_prn.Aparcament",
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
fillColor: "#dadae3",
|
|
244
|
+
codename: [
|
|
245
|
+
"OtrosCal",
|
|
246
|
+
"OtrosNoCal",
|
|
247
|
+
"Común",
|
|
248
|
+
"Sin datos",
|
|
249
|
+
"",
|
|
250
|
+
"None",
|
|
251
|
+
"null",
|
|
252
|
+
"undefined",
|
|
253
|
+
" ",
|
|
254
|
+
"NoCodificado",
|
|
255
|
+
],
|
|
256
|
+
title: "indicators.us_prn.None",
|
|
257
|
+
},
|
|
258
|
+
],
|
|
259
|
+
time: false,
|
|
260
|
+
},
|
|
261
|
+
],
|
|
262
|
+
},
|
|
263
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Menú de selección de idioma. Cambia el idioma de la aplicación usando la propiedad i18n
|
|
3
|
+
Recibe:
|
|
4
|
+
Langs-> array de los idiomas, con code (código de i18n), title (título para el menú), titleSelected (título para cuando está seleccionado, si varía del title)
|
|
5
|
+
arrow-> imagen de la flecha de despliegue del menú
|
|
6
|
+
imgPrev-> imagen previa al texto de idioma seleccionado (opcional)
|
|
7
|
+
Su css utiliza variables de la aplicación que habrá que incluirlas en el archivo variables.scss:
|
|
8
|
+
$langColor
|
|
9
|
+
$langBckColor
|
|
10
|
+
$langSelectedColor;
|
|
11
|
+
$langHoverColor
|
|
12
|
+
$langHoverBckColor
|
|
13
|
+
|
|
14
|
+
*/
|
|
15
|
+
import PropTypes from "prop-types"
|
|
16
|
+
import { useState } from "react"
|
|
17
|
+
import { useTranslation } from "react-i18next"
|
|
18
|
+
//styles
|
|
19
|
+
import style from "./LangSelector.module.scss"
|
|
20
|
+
export const LangSelector = ({ langs, arrow, imgPrev }) => {
|
|
21
|
+
const [showMenu, setshowMenu] = useState(false)
|
|
22
|
+
const { i18n } = useTranslation()
|
|
23
|
+
|
|
24
|
+
const currentLang = langs.find((l) => l.code == i18n.language)
|
|
25
|
+
const handleClick = (code) => {
|
|
26
|
+
i18n.changeLanguage(code)
|
|
27
|
+
setshowMenu(false)
|
|
28
|
+
}
|
|
29
|
+
return (
|
|
30
|
+
<div className={style.langSelector}>
|
|
31
|
+
<div
|
|
32
|
+
className={style.currentLang}
|
|
33
|
+
onClick={() => {
|
|
34
|
+
setshowMenu(!showMenu)
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
{imgPrev && <img className={style.prevImg} src={imgPrev} />}
|
|
38
|
+
{currentLang.titleSelected || currentLang.title}
|
|
39
|
+
<img src={arrow} className={style.arrow} />
|
|
40
|
+
</div>
|
|
41
|
+
{showMenu && (
|
|
42
|
+
<div className={style.langMenu}>
|
|
43
|
+
{langs.map((l) => (
|
|
44
|
+
<button
|
|
45
|
+
key={l.code}
|
|
46
|
+
className={currentLang.code == l.code ? style.active : ""}
|
|
47
|
+
onClick={() => handleClick(l.code)}
|
|
48
|
+
>
|
|
49
|
+
{l.title}
|
|
50
|
+
</button>
|
|
51
|
+
))}
|
|
52
|
+
</div>
|
|
53
|
+
)}
|
|
54
|
+
</div>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
LangSelector.propTypes = {
|
|
58
|
+
langs: PropTypes.arrayOf(
|
|
59
|
+
PropTypes.shape({
|
|
60
|
+
code: PropTypes.string,
|
|
61
|
+
title: PropTypes.string,
|
|
62
|
+
titleSelected: PropTypes.string,
|
|
63
|
+
})
|
|
64
|
+
),
|
|
65
|
+
color: PropTypes.string,
|
|
66
|
+
bckColor: PropTypes.string,
|
|
67
|
+
hoverColor: PropTypes.string,
|
|
68
|
+
arrow: PropTypes.object,
|
|
69
|
+
imgPrev: PropTypes.object,
|
|
70
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
.langSelector {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: fit-content;
|
|
4
|
+
}
|
|
5
|
+
.currentLang {
|
|
6
|
+
color: $langSelectedColor;
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
@include flex();
|
|
9
|
+
gap: 5px;
|
|
10
|
+
text-transform: capitalize;
|
|
11
|
+
.arrow {
|
|
12
|
+
width: 10px;
|
|
13
|
+
}
|
|
14
|
+
.prevImg {
|
|
15
|
+
width: 20px;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
.langMenu {
|
|
19
|
+
position: absolute;
|
|
20
|
+
width: 80px;
|
|
21
|
+
background: $langBckColor !important;
|
|
22
|
+
border-radius: 8px;
|
|
23
|
+
button {
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
background: $langBckColor !important;
|
|
26
|
+
color: $langColor;
|
|
27
|
+
width: 100%;
|
|
28
|
+
padding: 4px 8px;
|
|
29
|
+
text-align: left;
|
|
30
|
+
&:first-child {
|
|
31
|
+
border-radius: 8px 8px 0px 0px;
|
|
32
|
+
}
|
|
33
|
+
&:last-child {
|
|
34
|
+
border-radius: 0px 0px 8px 8px;
|
|
35
|
+
}
|
|
36
|
+
&:hover {
|
|
37
|
+
color: $langHoverColor;
|
|
38
|
+
background-color: $langHoverBckColor !important;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LangSelector } from "./LangSelector"
|
|
2
|
+
import arrow from "../../assets/img/arrowDown.svg"
|
|
3
|
+
import world from "../../assets/img/world.svg"
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/LangSelector",
|
|
6
|
+
component: LangSelector,
|
|
7
|
+
}
|
|
8
|
+
const Template = (args) => <LangSelector {...args} />
|
|
9
|
+
|
|
10
|
+
export const CatEsWithPrev = Template.bind({})
|
|
11
|
+
CatEsWithPrev.args = {
|
|
12
|
+
langs: [
|
|
13
|
+
{ code: "ca", title: "Català" },
|
|
14
|
+
{ code: "es", title: "Español" },
|
|
15
|
+
],
|
|
16
|
+
arrow: arrow,
|
|
17
|
+
imgPrev: world,
|
|
18
|
+
}
|
|
19
|
+
export const NoImg = Template.bind({})
|
|
20
|
+
NoImg.args = {
|
|
21
|
+
langs: [
|
|
22
|
+
{ code: "eu", title: "Euskera" },
|
|
23
|
+
{ code: "es", title: "Español" },
|
|
24
|
+
{ code: "en", title: "English" },
|
|
25
|
+
],
|
|
26
|
+
arrow: arrow,
|
|
27
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Legend of the map
|
|
3
|
+
*/
|
|
4
|
+
import PropTypes from "prop-types"
|
|
5
|
+
import { useTranslation } from "react-i18next"
|
|
6
|
+
//styles
|
|
7
|
+
import styles from "./Legend.module.scss"
|
|
8
|
+
|
|
9
|
+
export const Legend = ({
|
|
10
|
+
//JSON with the styles of the container (optional)
|
|
11
|
+
containerStyles,
|
|
12
|
+
//Title on top of the legend
|
|
13
|
+
title,
|
|
14
|
+
//Array to display the info behind the title should have: [{title, value}, ...]
|
|
15
|
+
infoList,
|
|
16
|
+
//Array to display the items of the legend: [{title, color}, ...]
|
|
17
|
+
//color should be a string with hexadecimal value
|
|
18
|
+
legendList,
|
|
19
|
+
//If not passed it will read t("mainUser")
|
|
20
|
+
legendListTitle,
|
|
21
|
+
//Should be an object with {maxColor, minColor, maxValue, minValue}
|
|
22
|
+
//If this has is not null or undefined, the legendList values wont be displayed.
|
|
23
|
+
//It will display only the absolute value indicator.
|
|
24
|
+
absoluteValue,
|
|
25
|
+
//Function to be called when the button is clicked (optional).
|
|
26
|
+
//If this is null or undefined the button wont be displayed.
|
|
27
|
+
onClickMoreInfo,
|
|
28
|
+
//If not passed it will read t("moreInformation")
|
|
29
|
+
buttonTitle,
|
|
30
|
+
onClickClose,
|
|
31
|
+
}) => {
|
|
32
|
+
|
|
33
|
+
const { t } = useTranslation()
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div
|
|
37
|
+
style={containerStyles ? { ...containerStyles } : {}}
|
|
38
|
+
className={`${styles.legendContainer}`}
|
|
39
|
+
>
|
|
40
|
+
<button className={styles.closeButton} onClick={onClickClose}></button>
|
|
41
|
+
{title && (
|
|
42
|
+
<div className={styles.titleContainer}>
|
|
43
|
+
<h2>{title}</h2>
|
|
44
|
+
</div>
|
|
45
|
+
)}
|
|
46
|
+
|
|
47
|
+
{infoList && infoList.length > 0 && (
|
|
48
|
+
<div className={styles.infoContainer}>
|
|
49
|
+
<ul>
|
|
50
|
+
{infoList.map(({ title: titleElement, value: valueElement }) => (
|
|
51
|
+
<li key={title}>
|
|
52
|
+
<h3 className={styles.title}>{`${titleElement}:`}</h3>
|
|
53
|
+
<span className={styles.value}> {valueElement}</span>
|
|
54
|
+
</li>
|
|
55
|
+
))}
|
|
56
|
+
</ul>
|
|
57
|
+
</div>
|
|
58
|
+
)}
|
|
59
|
+
<h3 className={styles.titleLegendList}>
|
|
60
|
+
{legendListTitle ? t(legendListTitle) : t("mainUse")}
|
|
61
|
+
</h3>
|
|
62
|
+
<div className={styles.legendListContainer}>
|
|
63
|
+
{absoluteValue ? (
|
|
64
|
+
<div className={styles.absoluteValueContainer}>
|
|
65
|
+
<div
|
|
66
|
+
className={styles.absoluteValueColor}
|
|
67
|
+
style={{
|
|
68
|
+
background: `linear-gradient(to bottom, ${absoluteValue.maxColor} 0%, ${absoluteValue.minColor} 100%)`,
|
|
69
|
+
}}
|
|
70
|
+
/>
|
|
71
|
+
<div className={styles.absoluteValueText}>
|
|
72
|
+
<span>{absoluteValue.maxValue} {t(absoluteValue.unit)}</span>
|
|
73
|
+
<span>{absoluteValue.minValue} {t(absoluteValue.unit)}</span>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
) : (
|
|
77
|
+
legendList &&
|
|
78
|
+
legendList.length > 0 && (
|
|
79
|
+
<div className={styles.gridContainer}>
|
|
80
|
+
{legendList.map(
|
|
81
|
+
({ title: titleElement, color: colorElement }) => (
|
|
82
|
+
<div className={styles.elementLegendContainer} key={title}>
|
|
83
|
+
<div
|
|
84
|
+
className={styles.colorDot}
|
|
85
|
+
style={{ backgroundColor: colorElement }}
|
|
86
|
+
/>
|
|
87
|
+
<div className={styles.titleLegendElement}>
|
|
88
|
+
{t(titleElement)}{" "}
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
)
|
|
92
|
+
)}
|
|
93
|
+
</div>
|
|
94
|
+
)
|
|
95
|
+
)}
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
{onClickMoreInfo && (
|
|
99
|
+
<button className={styles.moreInfoContainer} onClick={onClickMoreInfo}>
|
|
100
|
+
{buttonTitle ? buttonTitle : t("moreInformation")}
|
|
101
|
+
</button>
|
|
102
|
+
)}
|
|
103
|
+
</div>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
Legend.propTypes = {
|
|
108
|
+
title: PropTypes.string,
|
|
109
|
+
containerStyles: PropTypes.object,
|
|
110
|
+
infoList: PropTypes.arrayOf(
|
|
111
|
+
PropTypes.shape({
|
|
112
|
+
title: PropTypes.string.isRequired,
|
|
113
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
114
|
+
})
|
|
115
|
+
),
|
|
116
|
+
legendList: PropTypes.arrayOf(
|
|
117
|
+
PropTypes.shape({
|
|
118
|
+
title: PropTypes.string,
|
|
119
|
+
color: PropTypes.string,
|
|
120
|
+
})
|
|
121
|
+
),
|
|
122
|
+
legendListTitle: PropTypes.string,
|
|
123
|
+
absoluteValue: PropTypes.shape({
|
|
124
|
+
maxColor: PropTypes.string,
|
|
125
|
+
minColor: PropTypes.string,
|
|
126
|
+
maxValue: PropTypes.number,
|
|
127
|
+
minValue: PropTypes.number,
|
|
128
|
+
}),
|
|
129
|
+
onClickMoreInfo: PropTypes.func,
|
|
130
|
+
buttonTitle: PropTypes.string,
|
|
131
|
+
onClickClose: PropTypes.func,
|
|
132
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
|
|
2
|
+
.legendContainer {
|
|
3
|
+
width: 402px;
|
|
4
|
+
background-color: #fdfdfd;
|
|
5
|
+
color: #605b56;
|
|
6
|
+
border: solid 1.5px #605b56;
|
|
7
|
+
border-radius: 10px;
|
|
8
|
+
@include flex($direction: column, $align: flexStart);
|
|
9
|
+
padding: 20px;
|
|
10
|
+
position: relative;
|
|
11
|
+
|
|
12
|
+
.closeButton {
|
|
13
|
+
position: absolute;
|
|
14
|
+
right: 20px;
|
|
15
|
+
top: 20px;
|
|
16
|
+
width: 24px;
|
|
17
|
+
height: 24px;
|
|
18
|
+
border: none;
|
|
19
|
+
background: transparent;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
padding: 0;
|
|
22
|
+
display: inline-flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.closeButton::before,
|
|
28
|
+
.closeButton::after {
|
|
29
|
+
content: "";
|
|
30
|
+
position: absolute;
|
|
31
|
+
width: 16px;
|
|
32
|
+
height: 2px;
|
|
33
|
+
background-color: #333;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.closeButton::before {
|
|
37
|
+
transform: rotate(45deg);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.closeButton::after {
|
|
41
|
+
transform: rotate(-45deg);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.closeButton:hover::before,
|
|
45
|
+
.closeButton:hover::after {
|
|
46
|
+
// background-color: #e00;
|
|
47
|
+
}
|
|
48
|
+
.titleContainer {
|
|
49
|
+
border-bottom: solid 1.5px #605b56;
|
|
50
|
+
h2 {
|
|
51
|
+
padding-bottom: 16px;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.infoContainer {
|
|
56
|
+
padding-top: 20px;
|
|
57
|
+
ul {
|
|
58
|
+
li {
|
|
59
|
+
@include flex($justify: start, $align: center);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
.titleLegendList {
|
|
64
|
+
font-size: 20px;
|
|
65
|
+
padding-bottom: 20px;
|
|
66
|
+
margin-bottom: 20px;
|
|
67
|
+
margin-top: 30px;
|
|
68
|
+
border-bottom: solid 1.5px #605b56;
|
|
69
|
+
}
|
|
70
|
+
.legendListContainer {
|
|
71
|
+
.gridContainer {
|
|
72
|
+
display: grid;
|
|
73
|
+
grid-template-columns: auto; /* Dos columnas del mismo tamaño */
|
|
74
|
+
column-gap: 20px; /* Espacio horizontal entre columnas */
|
|
75
|
+
row-gap: 15px; /* Espacio vertical entre filas */
|
|
76
|
+
.elementLegendContainer {
|
|
77
|
+
//@include flex($direction: row, $justify: start, $align: center);
|
|
78
|
+
display: grid;
|
|
79
|
+
grid-template-columns: 23px auto;
|
|
80
|
+
align-items: center;
|
|
81
|
+
gap: 5px;
|
|
82
|
+
.colorDot {
|
|
83
|
+
width: 22px;
|
|
84
|
+
height: 22px;
|
|
85
|
+
border-radius: 50%;
|
|
86
|
+
margin-right: 10px;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
.absoluteValueContainer {
|
|
91
|
+
position: relative;
|
|
92
|
+
.absoluteValueColor {
|
|
93
|
+
height: 130px;
|
|
94
|
+
width: 22px;
|
|
95
|
+
border-radius: 20px;
|
|
96
|
+
}
|
|
97
|
+
.absoluteValueText {
|
|
98
|
+
@include flex(
|
|
99
|
+
$direction: column,
|
|
100
|
+
$justify: space-between,
|
|
101
|
+
$align: flex-start
|
|
102
|
+
);
|
|
103
|
+
position: absolute;
|
|
104
|
+
left: 30px;
|
|
105
|
+
top: 0px;
|
|
106
|
+
height: 100%;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
.moreInfoContainer {
|
|
111
|
+
margin-top: 30px;
|
|
112
|
+
padding-top: 8.5px;
|
|
113
|
+
padding-bottom: 8.5px;
|
|
114
|
+
padding-left: 20px;
|
|
115
|
+
padding-right: 20px;
|
|
116
|
+
@include flex();
|
|
117
|
+
border: 1.5px solid #605b56;
|
|
118
|
+
border-radius: 25px;
|
|
119
|
+
@include fontBaseSemi();
|
|
120
|
+
}
|
|
121
|
+
}
|