Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/containers/skillProgress/Progress.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
background-color: $progressBarSpanBG;
position: relative;
overflow: hidden;
transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.8s ease;
width: 0;
opacity: 0;
}
.skill {
line-height: 3.5vw;
Expand Down
52 changes: 38 additions & 14 deletions src/containers/skillProgress/skillProgress.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,54 @@
import React from "react";
import React, {useRef, useEffect, useState} from "react";
import "./Progress.scss";
import {illustration, techStack} from "../../portfolio";
import {Fade} from "react-reveal";
import Build from "../../assets/lottie/build";
import DisplayLottie from "../../components/displayLottie/DisplayLottie";

function useInView(options) {
const ref = useRef();
const [inView, setInView] = useState(false);

useEffect(() => {
const observer = new window.IntersectionObserver(([entry]) => {
if (entry.isIntersecting) {
setInView(true);
observer.disconnect();
}
}, options);
if (ref.current) observer.observe(ref.current);
return () => observer.disconnect();
}, [options]);

return [ref, inView];
}

function SkillBar({exp}) {
const [ref, inView] = useInView({threshold: 0.3});
const progressStyle = {
width: inView ? exp.progressPercentage : 0,
opacity: inView ? 1 : 0
};
return (
<div className="skill">
<p>{exp.Stack}</p>
<div className="meter" ref={ref}>
<span style={progressStyle}></span>
</div>
</div>
);
}

export default function StackProgress() {
if (techStack.viewSkillBars) {
return (
<Fade bottom duration={1000} distance="20px">
<div className="skills-container">
<div className="skills-bar">
<h1 className="skills-heading">Proficiency</h1>
{techStack.experience.map((exp, i) => {
const progressStyle = {
width: exp.progressPercentage
};
return (
<div key={i} className="skill">
<p>{exp.Stack}</p>
<div className="meter">
<span style={progressStyle}></span>
</div>
</div>
);
})}
{techStack.experience.map((exp, i) => (
<SkillBar exp={exp} key={i} />
))}
</div>

<div className="skills-image">
Expand Down