Skip to content

Commit 2715da7

Browse files
Merge pull request #87 from bitlogic/develop
Release 25-11-2024
2 parents fef647f + 178fcf7 commit 2715da7

File tree

14 files changed

+12653
-119
lines changed

14 files changed

+12653
-119
lines changed

gatsby-config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
require("dotenv").config({
2+
path: `.env`, // Asegúrate de que apunte al archivo correcto
3+
});
4+
15
module.exports = {
26
trailingSlash: "always",
37
siteMetadata: {
@@ -163,6 +167,13 @@ module.exports = {
163167
],
164168
},
165169
},
170+
{
171+
resolve: `gatsby-plugin-purgecss`,
172+
options: {
173+
printRejected: true, // Muestra las clases eliminadas en la consola
174+
develop: false, // PurgeCSS solo se ejecuta en producción
175+
},
176+
},
166177
"gatsby-plugin-offline",
167178
`gatsby-plugin-sass`,
168179
],

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"gatsby-plugin-image": "^2.6.0",
2020
"gatsby-plugin-manifest": "^4.6.0",
2121
"gatsby-plugin-offline": "^5.6.0",
22+
"gatsby-plugin-purgecss": "^6.2.1",
2223
"gatsby-plugin-robots-txt": "1.7.1",
2324
"gatsby-plugin-sass": "^5.6.0",
2425
"gatsby-plugin-sharp": "^4.6.0",

src/components/BannerList/BannerList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ BannerList.propTypes = {
5858
data: PropTypes.shape({
5959
title: PropTypes.string.isRequired,
6060
strapi_component: PropTypes.string.isRequired,
61-
id: PropTypes.string.isRequired,
61+
id: PropTypes.number.isRequired,
6262
contactForm: PropTypes.bool,
6363
concactFormAnchor: PropTypes.string,
6464
callToAction: PropTypes.string,

src/components/Form/Form.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
.title {
88
text-transform: uppercase;
99
}
10+
11+
h1{
12+
font-size: 42px;
13+
}
1014

1115
.form-wrapper {
1216
width: 100%;

src/components/Form/PipedriveForm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const PipedriveForm = ({ data }) => {
4040
<div className="container d-flex px-lg-2 flex-wrap">
4141
<div className="col-12 col-md-6 pe-md-5">
4242
{title && (
43-
<h2 className="title text-start">{title}</h2>
43+
<h1 className="title text-start">{title}</h1>
4444
)}
4545
{content && (
4646
<MarkdownView

src/components/NavBar/AnimatedNavBar/DropdownContainer/Dropdown.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ const Dropdown = memo(({ sections, topLevel }) => {
5656
<div
5757
className="dropdown_elem_topLevel"
5858
style={{
59-
borderBottom: "2px solid #808080",
6059
marginBottom: "15px",
6160
paddingBottom: "8px",
6261
}}

src/components/NavBar/AnimatedNavBar/DropdownContainer/DropdownItems.js

Lines changed: 57 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,45 @@
1-
import React, { memo } from "react"
1+
import React, { memo, useState, useEffect } from "react"
22
import "./DropdownItems.scss"
33
import CustomImage from "../../../CustomImage/CustomImage"
44
import CustomLink from "../../../CustomLink/CustomLink"
55
import PropTypes from "prop-types"
6+
import { FaAngleDown } from "react-icons/fa"
7+
8+
const RenderSection = ({section, className, isOpen, toggleSubLandingPages, isMobileView}) => {
9+
const { icon, label, url, english_landing_page, english_sub_landing_pages = [] } = section || {};
10+
const hasSubLandingPages = english_sub_landing_pages.length > 0;
611

7-
const RenderSection = ({section, className }) => {
812
return (
913
<>
10-
<div className={className}>
14+
<div
15+
className={className}
16+
>
1117
<CustomImage
12-
image={section?.icon}
13-
alt={section?.icon?.alternativeText || "NavLink Icon"}
18+
image={icon}
19+
alt={icon?.alternativeText || "NavLink Icon"}
1420
className="navbarItemIcon"
1521
width={28}
1622
height={28}
1723
/>
1824
<CustomLink
19-
content={section.label}
20-
url={section?.url}
21-
landing={section?.english_landing_page}
25+
content={label}
26+
url={url}
27+
landing={english_landing_page}
2228
className="dropdownItem_link-inner"
2329
/>
30+
{hasSubLandingPages &&
31+
<FaAngleDown
32+
className={`dropdownItem_icon ${isOpen ? "open" : ""}`}
33+
onClick={() => toggleSubLandingPages(section.id)}
34+
/>
35+
}
2436
</div>
2537
{section?.text && <p className="navItemP">{section.text}</p>}
26-
{section?.english_sub_landing_pages && section.english_sub_landing_pages.length > 0 && (
27-
<ul className="subLandingPages">
28-
{section.english_sub_landing_pages.map(subItem => (
29-
<li key={subItem.id}>
38+
39+
{(hasSubLandingPages && (isOpen || !isMobileView)) && (
40+
<ul className={`subLandingPages ${section.english_sub_landing_pages.length > 5 ? 'two-column-list' : ''}`} >
41+
{english_sub_landing_pages.map(subItem => (
42+
<li key={subItem.id} className="subLandingPages-item">
3043
<CustomLink
3144
content={subItem.name}
3245
url={`/${subItem.slug}`}
@@ -42,6 +55,7 @@ const RenderSection = ({section, className }) => {
4255

4356
RenderSection.propTypes = {
4457
section: PropTypes.shape({
58+
id: PropTypes.number.isRequired,
4559
icon: PropTypes.shape({
4660
alternativeText: PropTypes.string
4761
}),
@@ -51,16 +65,39 @@ RenderSection.propTypes = {
5165
english_landing_page: PropTypes.string,
5266
english_sub_landing_pages: PropTypes.arrayOf(
5367
PropTypes.shape({
54-
id: PropTypes.number.isRequired,
68+
id: PropTypes.number.isRequired,
5569
name: PropTypes.string.isRequired,
5670
slug: PropTypes.string.isRequired
5771
})
5872
)
5973
}).isRequired,
60-
className: PropTypes.string
74+
className: PropTypes.string,
75+
isOpen: PropTypes.bool.isRequired,
76+
toggleSubLandingPages: PropTypes.func.isRequired,
77+
isMobileView: PropTypes.bool.isRequired
6178
};
6279

80+
6381
const DropdownItems = memo(({ sections, topLevel }) => {
82+
83+
const [openSectionId, setOpenSectionId] = useState(null);
84+
const [isMobileView, setIsMobileView] = useState(window.innerWidth < 1200);
85+
86+
// Actualizar el estado `isMobileView` según el tamaño de la pantalla
87+
useEffect(() => {
88+
const handleResize = () => {
89+
setIsMobileView(window.innerWidth < 1200);
90+
};
91+
window.addEventListener("resize", handleResize);
92+
return () => window.removeEventListener("resize", handleResize);
93+
}, []);
94+
95+
const toggleSubLandingPages = (sectionId) => {
96+
if (isMobileView) {
97+
setOpenSectionId((prevId) => (prevId === sectionId ? null : sectionId));
98+
}
99+
};
100+
64101
return (
65102
<div className="dropdownItem_container" style={!sections ? { maxHeight: "0" } : {}}>
66103
<div className="dropdownItem_section" data-first-dropdown-section>
@@ -75,6 +112,9 @@ const DropdownItems = memo(({ sections, topLevel }) => {
75112
<RenderSection
76113
section={topLevel}
77114
className={"dropdownItem_link-topLevel"}
115+
isOpen={openSectionId === topLevel.id}
116+
toggleSubLandingPages={toggleSubLandingPages}
117+
isMobileView={isMobileView}
78118
/>
79119
</div>
80120
)}
@@ -84,6 +124,9 @@ const DropdownItems = memo(({ sections, topLevel }) => {
84124
<RenderSection
85125
section={section}
86126
className={"dropdownItem_link"}
127+
isOpen={openSectionId === section.id}
128+
toggleSubLandingPages={toggleSubLandingPages}
129+
isMobileView={isMobileView}
87130
/>
88131
</div>
89132
))}

src/components/NavBar/AnimatedNavBar/DropdownContainer/DropdownItems.scss

Lines changed: 28 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
}
1212

1313
&_section{
14+
background-color: #2b2b2b;
1415
display: flex;
1516
width: 100%;
1617
padding: 20px;
@@ -38,12 +39,11 @@
3839
flex-direction: row;
3940
align-items: center;
4041
font-size: 18px;
41-
padding-bottom: 0.1rem;
4242

4343
&-inner {
4444
text-align: start;
4545
color: $primary;
46-
padding: 2% 0;
46+
padding: 8px 0;
4747
font-weight: $standard;
4848

4949
&:hover {
@@ -56,7 +56,6 @@
5656
display: flex;
5757
flex-direction: row;
5858
align-items: center;
59-
border-right: "2px solid #808080";
6059
}
6160

6261
&-subLanding {
@@ -97,16 +96,28 @@
9796
list-style-type: none;
9897
text-align: start;
9998
margin-left: 1.7rem;
100-
10199
}
102100

101+
.two-column-list {
102+
display: grid;
103+
grid-template-columns: repeat(2, 1fr);
104+
padding: 0;
105+
list-style: none;
106+
}
107+
108+
.dropdownItem_icon {
109+
display: none;
110+
}
111+
103112
@media only screen and (max-width: 1200px) {
104113
.dropdownItem {
114+
background-color: #2b2b2b;
105115
&_container {
106116
flex-direction: column; // Cambia a una disposición vertical
107117
}
108118

109119
&_section {
120+
110121
padding-top: 28px;
111122
padding-right: 28px;
112123
padding-bottom: 14px;
@@ -124,50 +135,27 @@
124135
&_topLevel {
125136
width: 100%; // Asegura que el top level ocupe todo el ancho
126137
border-right: none; // Elimina la línea de separación si no es necesaria
127-
margin-right: 0; // Elimina el margen derecho
128-
padding-bottom: 8px; // Añade un poco de espacio debajo del top level
129138
border-bottom: 2px solid #808080;
130139
}
131140
}
132141

133142
.subLandingPages {
134143
margin-left: 1.3rem;
135-
}
136-
}
137-
138-
@media only screen and (max-width: 1200px) {
139-
.dropdownItem {
140-
&_container {
141-
flex-direction: column; // Cambia a una disposición vertical
142-
}
143-
144-
&_section {
145-
// Cambia el estilo si es necesario
146-
padding-top: 28px;
147-
padding-right: 28px;
148-
padding-bottom: 14px;
149-
padding-left: 28px;
144+
145+
&-item{
146+
height: 36px;
150147
display: flex;
151-
flex-direction: column; // Asegura que los subitems se alineen verticalmente
152-
}
153-
154-
&_content {
155-
flex-direction: column; // Asegura que los items dentro también sean verticales
156-
width: 100%; // Ocupará el 100% del ancho
157-
gap: 16px;
158-
}
159-
160-
&_topLevel {
161-
width: 100%; // Asegura que el top level ocupe todo el ancho
162-
border-right: none; // Elimina la línea de separación si no es necesaria
163-
margin-right: 0; // Elimina el margen derecho
164-
padding-bottom: 8px; // Añade un poco de espacio debajo del top level
165-
border-bottom: 2px solid #808080;
148+
align-items: center;
166149
}
150+
167151
}
168-
169-
.subLandingPages {
170-
margin-left: 1.3rem;
171-
// display: none; // Oculta los subitems en mobile
152+
153+
.dropdownItem_icon {
154+
display: block;
155+
color: $primary;
156+
157+
&.open {
158+
transform: rotate(180deg);
159+
}
172160
}
173161
}

src/components/NavBar/AnimatedNavBar/DropdownContainer/dropdown.scss

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,34 @@
22

33
.dropdown {
44
&_elem {
5-
width: 18.5rem;
5+
width: 40rem;
66

77
&-section {
88
padding-top: 28px;
99
padding-right: 28px;
1010
padding-bottom: 14px;
1111
padding-left: 28px;
12-
position: relative;
12+
display: flex;
1313

1414
.dropdown_section {
1515
display: flex;
1616
flex-direction: column;
1717
gap: 8px;
18+
width: 65%;
19+
padding-left: 20px;
1820
}
1921
}
2022

23+
&_topLevel{
24+
display: flex;
25+
flex-direction: column;
26+
justify-content: flex-start;
27+
align-items: flex-start;
28+
width: 35%;
29+
border-right: 2px solid #808080;
30+
padding-right: 20px;
31+
}
32+
2133
&-link {
2234
display: flex;
2335
flex-direction: row;
@@ -173,3 +185,31 @@
173185
opacity: 0;
174186
}
175187
}
188+
189+
@media screen and (max-width: 1200px) {
190+
.dropdown {
191+
&_elem {
192+
width: 18.5rem;
193+
width: 100%;
194+
&-section {
195+
flex-direction: column;
196+
.dropdown_section {
197+
padding-left: 0px;
198+
width: 100%;
199+
}
200+
}
201+
202+
&_topLevel {
203+
width: 100%;
204+
border-right: none;
205+
border-bottom: 2px solid #808080;
206+
}
207+
}
208+
}
209+
210+
.dropdown_root{
211+
&-inverted{
212+
width: 18.5rem;
213+
}
214+
}
215+
}

0 commit comments

Comments
 (0)