@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
package/src/index.scss
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
body,
|
|
2
|
+
*,
|
|
3
|
+
*::before,
|
|
4
|
+
*::after {
|
|
5
|
+
margin: 0;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
font-family: $mainFont;
|
|
8
|
+
padding: 0px;
|
|
9
|
+
}
|
|
10
|
+
html,
|
|
11
|
+
body {
|
|
12
|
+
height: 100%;
|
|
13
|
+
-webkit-font-smoothing: antialiased;
|
|
14
|
+
-moz-osx-font-smoothing: grayscale;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Elimina estilos de lista */
|
|
18
|
+
ul,
|
|
19
|
+
ol {
|
|
20
|
+
list-style: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* Elimina decoración de enlaces */
|
|
24
|
+
a,
|
|
25
|
+
.link {
|
|
26
|
+
text-decoration: none;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
color: inherit;
|
|
29
|
+
}
|
|
30
|
+
button {
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
}
|
|
33
|
+
/* Botones y formularios sin estilos base del navegador */
|
|
34
|
+
button,
|
|
35
|
+
input,
|
|
36
|
+
textarea,
|
|
37
|
+
select {
|
|
38
|
+
font: inherit;
|
|
39
|
+
background: none;
|
|
40
|
+
border: none;
|
|
41
|
+
outline: none;
|
|
42
|
+
padding: 0;
|
|
43
|
+
margin: 0;
|
|
44
|
+
color: inherit;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Imágenes responsivas */
|
|
48
|
+
img,
|
|
49
|
+
picture,
|
|
50
|
+
video,
|
|
51
|
+
canvas,
|
|
52
|
+
svg {
|
|
53
|
+
display: block;
|
|
54
|
+
max-width: 100%;
|
|
55
|
+
height: auto;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
p,
|
|
59
|
+
div {
|
|
60
|
+
@include fontBase();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
h1 {
|
|
64
|
+
@include fontTitols();
|
|
65
|
+
}
|
|
66
|
+
h2 {
|
|
67
|
+
@include fontSubtitols();
|
|
68
|
+
}
|
|
69
|
+
h3 {
|
|
70
|
+
@include fontBaseSemi();
|
|
71
|
+
}
|
|
72
|
+
.tooltip-parent {
|
|
73
|
+
position: relative;
|
|
74
|
+
width: fit-content;
|
|
75
|
+
|
|
76
|
+
.tooltip {
|
|
77
|
+
display: none;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&:hover {
|
|
81
|
+
.tooltip {
|
|
82
|
+
display:flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"login": "Acceso",
|
|
3
|
+
"indicators": "Indicadores",
|
|
4
|
+
"TopNavMenu": {
|
|
5
|
+
"opt1": "Test1",
|
|
6
|
+
"opt2": "Test2",
|
|
7
|
+
"opt3": "Test3"
|
|
8
|
+
},
|
|
9
|
+
"indicators": {
|
|
10
|
+
"indicators": "Indicadores",
|
|
11
|
+
"arq": "Arquitectónicos",
|
|
12
|
+
"arq_princ": "Indicadores principales"
|
|
13
|
+
},
|
|
14
|
+
"sampleText": "Texto test"
|
|
15
|
+
}
|
package/src/main.jsx
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Esta sección muestra una barra superior como Header de la aplicación. Permite mostrar elementos en los dos extremos de esta barra.
|
|
3
|
+
Los args que recibe son propiedades css y listados de componentes.
|
|
4
|
+
Propiedades css= backgroundColor y height
|
|
5
|
+
Listados de componentes:
|
|
6
|
+
leftComponents[]=>componentes que van en el extremo izquierdo de la barra, uno al lado del otro, ordenados de izquierda a derecha
|
|
7
|
+
rightComponents[]=>componentes que van en el extremo derecho de la barra, uno al lado del otro, ordenados de derecha a izquierda
|
|
8
|
+
centerComponents[]
|
|
9
|
+
los componentes se pasan como elementos jsx (ej: <Logo src={x} />)
|
|
10
|
+
*/
|
|
11
|
+
import PropTypes from 'prop-types';
|
|
12
|
+
//styles
|
|
13
|
+
import styles from './HeaderSection.module.scss';
|
|
14
|
+
|
|
15
|
+
export const HeaderSection = ({ cssProps, leftComponents = [], centerComponents = [], rightComponents = [] }) => {
|
|
16
|
+
return (
|
|
17
|
+
<div className={styles.header} style={cssProps}>
|
|
18
|
+
<div className={styles.leftComponents} style={{ height: cssProps.height }}>
|
|
19
|
+
{leftComponents.map((component, index) => (
|
|
20
|
+
<div style={{ height: cssProps.height }} key={index}>{component}</div>
|
|
21
|
+
))}
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<div className={styles.centerComponents} style={{ height: cssProps.height }}>
|
|
25
|
+
{centerComponents.map((component, index) => (
|
|
26
|
+
<div style={{ height: cssProps.height }} key={index}>{component}</div>
|
|
27
|
+
))}
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
<div className={styles.rightComponents} style={{ height: cssProps.height }}>
|
|
33
|
+
{rightComponents.map((component, index) => (
|
|
34
|
+
<div style={{ height: cssProps.height }} key={index}>{component}</div>
|
|
35
|
+
))}
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
HeaderSection.propTypes = {
|
|
42
|
+
cssProps: PropTypes.shape({
|
|
43
|
+
backgroundColor: PropTypes.string.isRequired,
|
|
44
|
+
height: PropTypes.string.isRequired,
|
|
45
|
+
borderColor: PropTypes.string,
|
|
46
|
+
textColor: PropTypes.string
|
|
47
|
+
}),
|
|
48
|
+
leftComponents: PropTypes.arrayOf(PropTypes.node),
|
|
49
|
+
centerComponents: PropTypes.arrayOf(PropTypes.node),
|
|
50
|
+
rightComponents: PropTypes.arrayOf(PropTypes.node),
|
|
51
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.header {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: $headerHeight;
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
position: relative;
|
|
7
|
+
padding: 0 16px;
|
|
8
|
+
background-color: #fff;
|
|
9
|
+
border-bottom: 1px solid black;
|
|
10
|
+
|
|
11
|
+
.leftComponents,
|
|
12
|
+
.centerComponents,
|
|
13
|
+
.rightComponents {
|
|
14
|
+
position: absolute;
|
|
15
|
+
top: 0;
|
|
16
|
+
bottom: 0;
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.leftComponents {
|
|
22
|
+
left: 16px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.centerComponents {
|
|
26
|
+
left: 50%;
|
|
27
|
+
transform: translateX(-50%);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.rightComponents {
|
|
31
|
+
right: 16px;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// components
|
|
2
|
+
import { HeaderSection } from "./HeaderSection";
|
|
3
|
+
import { LangSelector } from "../../components/LangSelector/LangSelector";
|
|
4
|
+
import { LogoApp } from "../../components/LogoApp/LogoApp";
|
|
5
|
+
import Options from '../../constants/topNavMenuOptions'
|
|
6
|
+
import { TopNavMenu } from "../../components/TopNavMenu/TopNavMenu";
|
|
7
|
+
import { UserMenuTrigger } from "../../components/UserMenuTrigger/UserMenuTrigger";
|
|
8
|
+
import arrow from '../../assets/img/arrowDown.svg'
|
|
9
|
+
//img
|
|
10
|
+
import sampleImg from "../../assets/img/sample2.png"
|
|
11
|
+
import world from '../../assets/img/world.svg'
|
|
12
|
+
export default {
|
|
13
|
+
component: HeaderSection,
|
|
14
|
+
title: "Sections/HeaderSection",
|
|
15
|
+
tags: ["header"],
|
|
16
|
+
args: {},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const Default = {
|
|
20
|
+
args: {
|
|
21
|
+
cssProps: {
|
|
22
|
+
backgroundColor: "#605B56",
|
|
23
|
+
height: "60px",
|
|
24
|
+
},
|
|
25
|
+
leftComponents: [<LogoApp key="logo" alt="alt" />], // Agrega "key" a cada componente dentro de un array
|
|
26
|
+
rightComponents: [<UserMenuTrigger key="menu" />],
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
const langs = [
|
|
30
|
+
{ code: 'ca', title: 'Català', titleSelected: 'Ca' },
|
|
31
|
+
{ code: 'es', title: 'Español', titleSelected: 'Es' }
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
export const WithLangSelector = {
|
|
35
|
+
args: {
|
|
36
|
+
cssProps: {
|
|
37
|
+
backgroundColor: "#605B56",
|
|
38
|
+
},
|
|
39
|
+
leftComponents: [<LogoApp key="logo" src={sampleImg} alt="My Logo" />],
|
|
40
|
+
rightComponents: [
|
|
41
|
+
<UserMenuTrigger key="menu2" />,
|
|
42
|
+
<LangSelector key="logo2" langs={langs} arrow={arrow} imgPrev={world} />,
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const WithNavbar = {
|
|
48
|
+
args: {
|
|
49
|
+
cssProps: {
|
|
50
|
+
backgroundColor: "#605B56",
|
|
51
|
+
borderColor: '#777777',
|
|
52
|
+
textColor: '#F8A925'
|
|
53
|
+
},
|
|
54
|
+
leftComponents: [<LogoApp key="logo" src={sampleImg} alt="My Logo" />],
|
|
55
|
+
centerComponents: [<TopNavMenu key="topMenu" options={Options} />],
|
|
56
|
+
rightComponents: [
|
|
57
|
+
<UserMenuTrigger key="menu2" />,
|
|
58
|
+
<LangSelector key="logo2" langs={langs} arrow={arrow} imgPrev={world} />,
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
2
|
+
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { setShowRightBar } from '../../store/rightBarSlice';
|
|
5
|
+
import styles from './RightSidebar.module.scss';
|
|
6
|
+
|
|
7
|
+
export const RightSidebar = ({ width = '300px', children }) => {
|
|
8
|
+
const showRightBar = useSelector((state) => state.rightBarState.showRightBar);
|
|
9
|
+
const dispatch = useDispatch();
|
|
10
|
+
|
|
11
|
+
const handleClose = () => {
|
|
12
|
+
dispatch(setShowRightBar(false));
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div
|
|
17
|
+
className={`${styles.sidebar} ${showRightBar ? styles.open : ''}`}
|
|
18
|
+
style={{ width: showRightBar ? width : 0 }}
|
|
19
|
+
>
|
|
20
|
+
{showRightBar && (
|
|
21
|
+
<div className={styles.content}>
|
|
22
|
+
<button className={styles.closeButton} onClick={handleClose}>
|
|
23
|
+
×
|
|
24
|
+
</button>
|
|
25
|
+
{children}
|
|
26
|
+
</div>
|
|
27
|
+
)}
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
RightSidebar.propTypes = {
|
|
33
|
+
width: PropTypes.string,
|
|
34
|
+
children: PropTypes.node,
|
|
35
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
.sidebar {
|
|
2
|
+
position: fixed;
|
|
3
|
+
top: 0;
|
|
4
|
+
right: 0;
|
|
5
|
+
height: 100%;
|
|
6
|
+
background-color: #ffffff;
|
|
7
|
+
box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
|
|
8
|
+
overflow-x: hidden;
|
|
9
|
+
overflow-y: auto;
|
|
10
|
+
transition: width 0.3s ease;
|
|
11
|
+
z-index: 1000;
|
|
12
|
+
width: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.open {
|
|
16
|
+
border-left: 1px solid #ddd;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.content {
|
|
20
|
+
position: relative;
|
|
21
|
+
padding: 20px;
|
|
22
|
+
height: 100%;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.closeButton {
|
|
26
|
+
position: absolute;
|
|
27
|
+
top: 10px;
|
|
28
|
+
right: 10px;
|
|
29
|
+
font-size: 24px;
|
|
30
|
+
background: none;
|
|
31
|
+
border: none;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
color: #333;
|
|
34
|
+
transition: color 0.2s ease;
|
|
35
|
+
|
|
36
|
+
&:hover {
|
|
37
|
+
color: #000;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {RightSidebar} from './RightSidebar';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Sections/RightSidebar',
|
|
6
|
+
component: RightSidebar,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const Template = (args) => (
|
|
12
|
+
|
|
13
|
+
<RightSidebar {...args} />
|
|
14
|
+
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export const Default = Template.bind({});
|
|
18
|
+
Default.args = {
|
|
19
|
+
width: '300px',
|
|
20
|
+
children: <div>Contenido del sidebar</div>,
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './store'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './mapSlice.js'
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createSlice } from "@reduxjs/toolkit"
|
|
2
|
+
|
|
3
|
+
export const mapSlice = createSlice({
|
|
4
|
+
name: 'mapSlice',
|
|
5
|
+
initialState: {
|
|
6
|
+
showTexts: true,
|
|
7
|
+
sliderSelectedYear: 2025,
|
|
8
|
+
activeIndicatorKey: 0,
|
|
9
|
+
activeIndicatorType: 'cat',
|
|
10
|
+
activeIndicatorUnit: null
|
|
11
|
+
},
|
|
12
|
+
reducers: {
|
|
13
|
+
setShowTexts: (state, action) => {
|
|
14
|
+
state.showTexts = action.payload
|
|
15
|
+
},
|
|
16
|
+
setYear: (state, action) => {
|
|
17
|
+
state.sliderSelectedYear = action.payload
|
|
18
|
+
},
|
|
19
|
+
setActiveIndicatorKey: (state, action) => {
|
|
20
|
+
state.activeIndicatorKey = action.payload
|
|
21
|
+
},
|
|
22
|
+
setActiveIndicatorType: (state, action) => {
|
|
23
|
+
state.activeIndicatorType = action.payload
|
|
24
|
+
},
|
|
25
|
+
setActiveIndicatorUnit: (state, action) => {
|
|
26
|
+
state.activeIndicatorUnit = action.payload
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
export const { setShowTexts, setYear, setActiveIndicatorKey, setActiveIndicatorType, setActiveIndicatorUnit } = mapSlice.actions
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './rightBarSlice'
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
3
|
+
|
|
4
|
+
export const rightBarSlice = createSlice({
|
|
5
|
+
name: 'rightBar',
|
|
6
|
+
initialState: {
|
|
7
|
+
showRightBar: true,
|
|
8
|
+
children: '',
|
|
9
|
+
width:'500px'
|
|
10
|
+
},
|
|
11
|
+
reducers: {
|
|
12
|
+
toggleRightBar: (state) => {
|
|
13
|
+
state.showRightBar = !state.showRightBar;
|
|
14
|
+
},
|
|
15
|
+
setShowRightBar: (state, action) => {
|
|
16
|
+
state.showRightBar = action.payload;
|
|
17
|
+
},
|
|
18
|
+
setRightBarChildren: (state, action) => {
|
|
19
|
+
state.children = action.payload
|
|
20
|
+
},
|
|
21
|
+
setRightBarWidth: (state, action) => {
|
|
22
|
+
state.width = action.payload
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const { toggleRightBar, setShowRightBar, setRightBarChildren, setRightBarWidth } = rightBarSlice.actions;
|
|
28
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './routerSlice.js'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createSlice } from "@reduxjs/toolkit"
|
|
2
|
+
|
|
3
|
+
export const routerSlice = createSlice({
|
|
4
|
+
name: 'routerSlice',
|
|
5
|
+
initialState: {
|
|
6
|
+
currentRoute: false,
|
|
7
|
+
},
|
|
8
|
+
reducers: {
|
|
9
|
+
setCurrentRoute: (state, action) => {
|
|
10
|
+
state.showLogIn = action.payload
|
|
11
|
+
},
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
export const { setCurrentRoute } = routerSlice.actions
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { combineReducers, configureStore } from "@reduxjs/toolkit"
|
|
2
|
+
|
|
3
|
+
import { mapSlice } from "./mapSlice"
|
|
4
|
+
import { routerSlice } from "./routerSlice"
|
|
5
|
+
import { userSlice } from "./userSlice"
|
|
6
|
+
import { rightBarSlice } from "./rightBarSlice"
|
|
7
|
+
|
|
8
|
+
export const rootReducer = combineReducers({
|
|
9
|
+
userState: userSlice.reducer,
|
|
10
|
+
mapState: mapSlice.reducer,
|
|
11
|
+
routerState: routerSlice.reducer,
|
|
12
|
+
rightBarState: rightBarSlice.reducer
|
|
13
|
+
})
|
|
14
|
+
export const store = configureStore({ reducer: rootReducer })
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './userSlice'
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createSlice } from "@reduxjs/toolkit"
|
|
2
|
+
|
|
3
|
+
export const userSlice = createSlice({
|
|
4
|
+
name: 'userSlice',
|
|
5
|
+
initialState: {
|
|
6
|
+
user: {
|
|
7
|
+
isLoggedIn: false,
|
|
8
|
+
username: '',
|
|
9
|
+
},
|
|
10
|
+
showLogIn: false,
|
|
11
|
+
showUserMenu: false,
|
|
12
|
+
},
|
|
13
|
+
reducers: {
|
|
14
|
+
setShowLogIn: (state, action) => {
|
|
15
|
+
state.showLogIn = action.payload
|
|
16
|
+
},
|
|
17
|
+
setShowUserMenu: (state, action) => {
|
|
18
|
+
state.showUserMenu = action.payload
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
export const { setShowLogIn, setShowUserMenu } = userSlice.actions
|
package/vite.config.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineConfig } from "vite"
|
|
2
|
+
import react from "@vitejs/plugin-react"
|
|
3
|
+
import path from "path"
|
|
4
|
+
// https://vite.dev/config/
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
plugins: [react()],
|
|
7
|
+
resolve: {
|
|
8
|
+
alias: {
|
|
9
|
+
"@": path.resolve(__dirname, "src"),
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
css: {
|
|
13
|
+
preprocessorOptions: {
|
|
14
|
+
scss: {
|
|
15
|
+
additionalData: `@use "@/_variables.scss" as *;`,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
build: {
|
|
20
|
+
lib: {
|
|
21
|
+
entry: 'src/index.js',
|
|
22
|
+
name: 'Ciclica Front',
|
|
23
|
+
fileName: (format) => `ciclica-front.${format}.js`,
|
|
24
|
+
},
|
|
25
|
+
rollupOptions: {
|
|
26
|
+
external: ['react', 'react-dom'],
|
|
27
|
+
output: {
|
|
28
|
+
globals: {
|
|
29
|
+
react: 'React',
|
|
30
|
+
'react-dom': 'ReactDOM',
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
cssCodeSplit: false
|
|
35
|
+
}
|
|
36
|
+
})
|