fixed bug related to flexbox preventing accordion logic on mobile. need to fix skill cards position on desktop

This commit is contained in:
Joshua Ashton
2024-12-31 13:48:49 -07:00
parent 011c690d2a
commit 50aa2c8ccf
5 changed files with 50 additions and 81 deletions
+3 -3
View File
@@ -18,9 +18,9 @@ Week 1: 17/12/24 - 23/12/24 (Planning for the future)
Bug Fixes: Bug Fixes:
- [ ] Breathing animation of background gradient stopped. - [x] Breathing animation of background gradient stopped.
- [ ] Add state to skill accordions for mobile. - [x] Add state to skill accordions for mobile.
- [ ] Alignment of project card on mobile. - [x] Alignment of project card on mobile.
- [ ] Profile picture animation is slightly cutoff on mobile. - [ ] Profile picture animation is slightly cutoff on mobile.
Week 2: 24/12/24 - 30/12/24 (Adding key information) Week 2: 24/12/24 - 30/12/24 (Adding key information)
+3 -12
View File
@@ -1,7 +1,6 @@
// TODO: Replace h4 callToAction with a GREEN button callToAction. // TODO: Replace h4 callToAction with a GREEN button callToAction.
import React, { useState, useRef } from "react"; import React, { useState } from "react";
import SkillCard from "./components/SkillCard"; import SkillCard from "./components/SkillCard";
import { terminal } from "virtual:terminal";
export default function Primary({ export default function Primary({
primaryText, primaryText,
@@ -11,7 +10,7 @@ export default function Primary({
skills, skills,
initState, initState,
}) { }) {
const [activeCardIndex, setActiveCardIndex] = useState(null); let [activeCardIndex, setActiveCardIndex] = useState(null);
return ( return (
<> <>
<div id="primary"> <div id="primary">
@@ -25,14 +24,11 @@ export default function Primary({
<img id="profile" src={image} /> <img id="profile" src={image} />
</div> </div>
</div> </div>
<div id="skills-section"> <div id="skills-cards">
<div className="cards">
<SkillCard <SkillCard
header="Languages" header="Languages"
symbol="code" symbol="code"
list={skills.languages} list={skills.languages}
initState={initState[0]}
index={0}
isActive={activeCardIndex === 0} isActive={activeCardIndex === 0}
onToggle={() => setActiveCardIndex(0)} onToggle={() => setActiveCardIndex(0)}
/> />
@@ -40,8 +36,6 @@ export default function Primary({
header="Tools" header="Tools"
symbol="terminal" symbol="terminal"
list={skills.tools} list={skills.tools}
initState={initState[1]}
index={1}
isActive={activeCardIndex === 1} isActive={activeCardIndex === 1}
onToggle={() => setActiveCardIndex(1)} onToggle={() => setActiveCardIndex(1)}
/> />
@@ -49,13 +43,10 @@ export default function Primary({
header="Other" header="Other"
symbol="hub" symbol="hub"
list={skills.other} list={skills.other}
initState={initState[2]}
index={2}
isActive={activeCardIndex === 2} isActive={activeCardIndex === 2}
onToggle={() => setActiveCardIndex(2)} onToggle={() => setActiveCardIndex(2)}
/> />
</div> </div>
</div>
<span className="material-icons down-indicator"> <span className="material-icons down-indicator">
keyboard_double_arrow_down keyboard_double_arrow_down
</span> </span>
+6 -9
View File
@@ -2,17 +2,14 @@ import React, { useState } from "react";
// TODO: Add state which only allows one skill card at a time to be expanded. // TODO: Add state which only allows one skill card at a time to be expanded.
// TODO: Ensure that the expandability of the skill card is only an option when @media max-width 790px (mobile) // TODO: Ensure that the expandability of the skill card is only an option when @media max-width 790px (mobile)
const SkillCard = ({ header, symbol, list, initState, isActive, onToggle }) => { const SkillCard = ({ header, symbol, list, isActive, onToggle }) => {
const [isExpanded, setIsExpanded] = useState(initState || isActive); function test() {
console.log("click detected");
const toggleExpansion = () => {
setIsExpanded(!isExpanded);
onToggle(); onToggle();
}; }
return ( return (
<div className={`card shadow ${isActive ? "active-skill-card" : ""}`}> <div className="card shadow">
<div className="skill-section-header" onClick={() => toggleExpansion()}> <div className="skill-card-header" onClick={() => test()}>
<span className="material-icons skill-symbol">{symbol}</span> <span className="material-icons skill-symbol">{symbol}</span>
<h3>{header}</h3> <h3>{header}</h3>
</div> </div>
+1 -1
View File
@@ -24,7 +24,7 @@ export default function VerticalSlider({ slides }) {
> >
{slides.map((slide, index) => ( {slides.map((slide, index) => (
<SwiperSlide key={index}> <SwiperSlide key={index}>
{({ isActive }) => <div className="slide-container">{slide}</div>} {<div className="slide-container">{slide}</div>}
</SwiperSlide> </SwiperSlide>
))} ))}
</Swiper> </Swiper>
+16 -35
View File
@@ -23,8 +23,8 @@
body { body {
margin: 0; margin: 0;
height: 100vh;
position: relative; position: relative;
height: 100%;
background: linear-gradient( background: linear-gradient(
135deg, 135deg,
#84509f 0%, #84509f 0%,
@@ -32,7 +32,10 @@ body {
#39124e 61%, #39124e 61%,
#170123 100% #170123 100%
); );
animation: background-fade 1s linear infinite; background-size:
300% 100%,
cover;
animation: background-fade 4s linear infinite;
animation-direction: alternate; animation-direction: alternate;
background-attachment: fixed; background-attachment: fixed;
} }
@@ -69,10 +72,7 @@ h4 {
font-size: 5vw; font-size: 5vw;
color: #ebd2ff; color: #ebd2ff;
display: flex; margin: 0 auto;
flex-direction: column;
align-items: center;
justify-content: center;
} }
.shadow { .shadow {
@@ -101,14 +101,14 @@ h4 {
/**ACTIVE PAGE ANIMATIONS**/ /**ACTIVE PAGE ANIMATIONS**/
.swiper-slide-active #header, .swiper-slide-active #header,
.swiper-slide-active #skills-section, .swiper-slide-active #skill-cards,
.swiper-slide-active #project-section, .swiper-slide-active #project-section,
.swiper-slide-active #project-cards-section { .swiper-slide-active #project-cards-section {
opacity: 0; opacity: 0;
} }
.swiper-slide-active #header, .swiper-slide-active #header,
.swiper-slide-active #skills-section, .swiper-slide-active #skill-cards,
.swiper-slide-active #project-section, .swiper-slide-active #project-section,
.swiper-slide-active #project-cards-section, .swiper-slide-active #project-cards-section,
.down-indicator { .down-indicator {
@@ -121,7 +121,7 @@ h4 {
animation-delay: 0.2s; animation-delay: 0.2s;
} }
.swiper-slide-active #skills-section, .swiper-slide-active #skills-cards,
.swiper-slide-active #project-cards-section { .swiper-slide-active #project-cards-section {
animation-delay: 0.8s; animation-delay: 0.8s;
} }
@@ -195,34 +195,21 @@ h4 {
animation: imgMoveDown 0.8s ease-in forwards 0.2s; animation: imgMoveDown 0.8s ease-in forwards 0.2s;
} }
#skills-section { #skills-cards {
width: 100%; width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
}
.cards {
display: grid; display: grid;
grid-template-columns: 30% 30% 30%; place-items: center;
grid-template-rows: 100%;
column-gap: 2.25vw;
justify-content: center;
} }
/**SKILL CARDS**/ /**SKILL CARDS**/
.card { .card {
align-items: center;
justify-content: center;
text-align: center; text-align: center;
background-color: #ebd2ff; background-color: #ebd2ff;
border-radius: 20px; border-radius: 20px;
width: 20vw; min-width: 20vw;
} }
.card .skill-section-header { .skill-card-header {
display: grid; display: grid;
grid-template-columns: 20% 60%; grid-template-columns: 20% 60%;
grid-template-rows: 100%; grid-template-rows: 100%;
@@ -235,11 +222,9 @@ h4 {
margin: 0; margin: 0;
background-color: #4a245e; background-color: #4a245e;
border-radius: 18px 18px 0 0; border-radius: 18px 18px 0 0;
width: 100%;
} }
.card .skill-section-header .skill-symbol { .skill-symbol {
font-variation-settings: font-variation-settings:
"FILL" 0, "FILL" 0,
"wght" 200, "wght" 200,
@@ -485,18 +470,17 @@ h4 {
justify-content: left; justify-content: left;
} }
#skills-section .card .skill-section-header { .skill-card-header {
border-radius: 18px 18px 18px 18px; border-radius: 18px 18px 18px 18px;
} }
.cards { .cards {
grid-template-columns: 100%; grid-template-columns: 100%;
grid-template-rows: 30% 30% 30%; grid-template-rows: 30% 30% 30%;
column-gap: 0;
} }
.card { .card {
width: 50vw; min-width: 50vw;
margin: 1vw; margin: 1vw;
} }
@@ -536,9 +520,6 @@ h4 {
.project-text-column { .project-text-column {
margin-left: 5vw; margin-left: 5vw;
} }
.button {
}
} }
@media (max-width: 485px) { @media (max-width: 485px) {