@tmf_ciclica/ciclicastorybook 1.0.12 → 1.0.15

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.
Files changed (134) hide show
  1. package/package.json +32 -54
  2. package/.storybook/main.js +0 -21
  3. package/.storybook/preview.jsx +0 -31
  4. package/eslint.config.js +0 -38
  5. package/index.html +0 -13
  6. package/public/vite.svg +0 -1
  7. package/src/App.css +0 -0
  8. package/src/App.jsx +0 -36
  9. package/src/_variables.scss +0 -56
  10. package/src/assets/img/arrowDown.svg +0 -3
  11. package/src/assets/img/closeIcon.svg +0 -4
  12. package/src/assets/img/copyIcon.svg +0 -17
  13. package/src/assets/img/deleteIcon.svg +0 -6
  14. package/src/assets/img/eyeActiveIcon.svg +0 -6
  15. package/src/assets/img/eyeNotActiveIcon.svg +0 -8
  16. package/src/assets/img/filtersIcon.svg +0 -6
  17. package/src/assets/img/langarrow.png +0 -0
  18. package/src/assets/img/pause.svg +0 -5
  19. package/src/assets/img/play.svg +0 -4
  20. package/src/assets/img/processingIcon.svg +0 -20
  21. package/src/assets/img/sample-image.png +0 -0
  22. package/src/assets/img/sample2.png +0 -0
  23. package/src/assets/img/world.svg +0 -3
  24. package/src/assets/mapStyles/mapStyle.js +0 -781
  25. package/src/components/AmbitSelector/AmbitItem/AmbitItem.jsx +0 -74
  26. package/src/components/AmbitSelector/AmbitItem/AmbitItem.module.scss +0 -27
  27. package/src/components/AmbitSelector/AmbitSelector.jsx +0 -68
  28. package/src/components/AmbitSelector/AmbitSelector.module.scss +0 -29
  29. package/src/components/AmbitSelector/AmbitSelector.stories.jsx +0 -21
  30. package/src/components/ButtonsList/ButtonsList.jsx +0 -92
  31. package/src/components/ButtonsList/ButtonsList.module.scss +0 -37
  32. package/src/components/ButtonsList/ButtonsList.stories.jsx +0 -55
  33. package/src/components/DropdownList/DropdownList.jsx +0 -69
  34. package/src/components/DropdownList/DropdownList.module.scss +0 -20
  35. package/src/components/DropdownList/DropdownList.stories.jsx +0 -22
  36. package/src/components/DropdownList/DropdownListExample/DropDownListExample.jsx +0 -33
  37. package/src/components/DropdownList/DropdownListExample/DropdownListExample.stories.jsx +0 -11
  38. package/src/components/EditAmbit/EditAmbit.jsx +0 -7
  39. package/src/components/FiltersAmbit/AppliedFilters/AppliedFilters.jsx +0 -57
  40. package/src/components/FiltersAmbit/AppliedFilters/AppliedFilters.module.scss +0 -13
  41. package/src/components/FiltersAmbit/AppliedFilters/AppliedFilters.stories.jsx +0 -47
  42. package/src/components/FiltersAmbit/FiltersAmbit.jsx +0 -58
  43. package/src/components/FiltersAmbit/FiltersAmbit.module.scss +0 -28
  44. package/src/components/FiltersAmbit/FiltersAmbit.stories.jsx +0 -36
  45. package/src/components/FiltersAmbit/GeographicFilters/GeographicalFilters.jsx +0 -33
  46. package/src/components/FiltersAmbit/GeographicFilters/GeographicalFilters.module.scss +0 -13
  47. package/src/components/FiltersAmbit/GeographicFilters/GeographicalFilters.stories.jsx +0 -47
  48. package/src/components/FiltersAmbit/TematicalFilters/TematicalFilters.jsx +0 -83
  49. package/src/components/FiltersAmbit/TematicalFilters/TematicalFilters.module.scss +0 -8
  50. package/src/components/FiltersAmbit/TematicalFilters/TematicalFilters.stories.jsx +0 -17
  51. package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersCategory/TematicalFiltersCategory.jsx +0 -60
  52. package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/AbsoluteSlider/AbsoluteSlider.jsx +0 -61
  53. package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/AbsoluteSlider/AbsoluteSlider.module.scss +0 -45
  54. package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/CategoryCheckbox/CategoryChackbox.module.scss +0 -18
  55. package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/CategoryCheckbox/CategoryCheckbox.jsx +0 -47
  56. package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/TematicalFiltersInput.jsx +0 -267
  57. package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersInput/TematicalFiltersInput.module.scss +0 -31
  58. package/src/components/FiltersAmbit/TematicalFilters/TematicalFiltersSubcat/TematicalFiltersSubcat.jsx +0 -58
  59. package/src/components/FiltersAmbit/useAmbitStore.jsx +0 -10
  60. package/src/components/Graphic/BarChart/BarChart.jsx +0 -146
  61. package/src/components/Graphic/BarChart/BarChart.module.scss +0 -5
  62. package/src/components/Graphic/BarChart/BarChart.stories.jsx +0 -18
  63. package/src/components/Graphic/Graphic.jsx +0 -55
  64. package/src/components/Graphic/Graphic.module.scss +0 -12
  65. package/src/components/Graphic/Graphic.stories.jsx +0 -25
  66. package/src/components/IndicatorsList/Indicator/Indicator.jsx +0 -180
  67. package/src/components/IndicatorsList/Indicator/Indicator.module.scss +0 -46
  68. package/src/components/IndicatorsList/IndicatorSubCategory/IndicatorSubCategory.jsx +0 -76
  69. package/src/components/IndicatorsList/IndicatorSubCategory/IndicatorSubCategory.module.scss +0 -12
  70. package/src/components/IndicatorsList/IndicatorsCategory/IndicatorsCategory.jsx +0 -122
  71. package/src/components/IndicatorsList/IndicatorsCategory/IndicatorsCategory.module.scss +0 -20
  72. package/src/components/IndicatorsList/IndicatorsList.jsx +0 -173
  73. package/src/components/IndicatorsList/IndicatorsList.module.scss +0 -10
  74. package/src/components/IndicatorsList/IndicatorsList.stories.jsx +0 -263
  75. package/src/components/LangSelector/LangSelector.jsx +0 -70
  76. package/src/components/LangSelector/LangSelector.module.scss +0 -41
  77. package/src/components/LangSelector/LangSelector.stories.jsx +0 -27
  78. package/src/components/Legend/Legend.jsx +0 -132
  79. package/src/components/Legend/Legend.module.scss +0 -121
  80. package/src/components/Legend/Legend.stories.jsx +0 -53
  81. package/src/components/LogoApp/LogoApp.jsx +0 -33
  82. package/src/components/LogoApp/LogoApp.module.scss +0 -7
  83. package/src/components/LogoApp/LogoApp.stories.jsx +0 -27
  84. package/src/components/MapboxMap/MapboxMap.jsx +0 -160
  85. package/src/components/MapboxMap/MapboxMap.module.scss +0 -4
  86. package/src/components/MapboxMap/MapboxMap.stories.jsx +0 -57
  87. package/src/components/MaplibreMap/MaplibreMap.jsx +0 -166
  88. package/src/components/MaplibreMap/MaplibreMap.module.scss +0 -5
  89. package/src/components/MaplibreMap/MaplibreMap.stories.jsx +0 -55
  90. package/src/components/SectionBar/SectionBar.jsx +0 -41
  91. package/src/components/SectionBar/SectionBar.module.scss +0 -40
  92. package/src/components/SectionBar/SectionBar.stories.jsx +0 -35
  93. package/src/components/TimeSlider/TimeSlider.jsx +0 -147
  94. package/src/components/TimeSlider/TimeSlider.module.scss +0 -63
  95. package/src/components/TimeSlider/TimeSlider.stories.jsx +0 -9
  96. package/src/components/Tooltip/Tooltip.jsx +0 -40
  97. package/src/components/Tooltip/Tooltip.module.scss +0 -141
  98. package/src/components/Tooltip/Tooltip.stories.jsx +0 -51
  99. package/src/components/TopNavMenu/TopNavMenu.jsx +0 -62
  100. package/src/components/TopNavMenu/TopNavMenu.module.scss +0 -21
  101. package/src/components/TopNavMenu/TopNavMenu.stories.jsx +0 -20
  102. package/src/components/UserMenuTrigger/UserMenuTrigger.jsx +0 -47
  103. package/src/components/UserMenuTrigger/UserMenuTrigger.module.scss +0 -5
  104. package/src/components/UserMenuTrigger/UserMenuTrigger.stories.jsx +0 -33
  105. package/src/components/index.jsx +0 -17
  106. package/src/constants/indicators.js +0 -1371
  107. package/src/constants/mapTexts.js +0 -161
  108. package/src/constants/textLayers.js +0 -639
  109. package/src/constants/topNavMenuOptions.js +0 -14
  110. package/src/i18n.js +0 -19
  111. package/src/index.jsx +0 -2
  112. package/src/index.scss +0 -87
  113. package/src/locales/ca.json +0 -8
  114. package/src/locales/es.json +0 -15
  115. package/src/main.jsx +0 -10
  116. package/src/sections/HeaderSection/HeaderSection.jsx +0 -51
  117. package/src/sections/HeaderSection/HeaderSection.module.scss +0 -33
  118. package/src/sections/HeaderSection/HeaderSection.stories.jsx +0 -61
  119. package/src/sections/RightSidebar/RightSidebar.jsx +0 -35
  120. package/src/sections/RightSidebar/RightSidebar.module.scss +0 -39
  121. package/src/sections/RightSidebar/RightSidebar.stories.jsx +0 -21
  122. package/src/sections/index.jsx +0 -2
  123. package/src/store/index.js +0 -1
  124. package/src/store/mapSlice/index.js +0 -1
  125. package/src/store/mapSlice/mapSlice.js +0 -30
  126. package/src/store/rightBarSlice/index.js +0 -1
  127. package/src/store/rightBarSlice/rightBarSlice.js +0 -28
  128. package/src/store/routerSlice/index.js +0 -1
  129. package/src/store/routerSlice/routerSlice.js +0 -14
  130. package/src/store/store.js +0 -14
  131. package/src/store/userSlice/index.js +0 -1
  132. package/src/store/userSlice/userSlice.js +0 -22
  133. package/tmf_ciclica-ciclicastorybook-1.0.8.tgz +0 -0
  134. package/vite.config.js +0 -49
@@ -1,263 +0,0 @@
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
- }
@@ -1,70 +0,0 @@
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
- }
@@ -1,41 +0,0 @@
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
- }
@@ -1,27 +0,0 @@
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
- }
@@ -1,132 +0,0 @@
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}>&nbsp; {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
- }
@@ -1,121 +0,0 @@
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
- }