mirror of
https://github.com/DerTyp7/dertyp7.github.io.git
synced 2025-10-29 12:52:08 +01:00
Add typewriter effect to job title in About section
This commit is contained in:
@@ -1,12 +1,30 @@
|
||||
import "@styles/About.scss";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export default function About() {
|
||||
const [job, setJob] = useState("Software Developer");
|
||||
const jobs = ["Software Developer", "Frontend Developer", "Software Planner"];
|
||||
|
||||
useEffect(() => {
|
||||
let jobIndex = 0;
|
||||
const intervalId = setInterval(() => {
|
||||
jobIndex = jobIndex + 1 === jobs.length ? 0 : jobIndex + 1;
|
||||
setJob(jobs[jobIndex]);
|
||||
}, 7000);
|
||||
|
||||
return () => clearInterval(intervalId); // Clean up on unmount
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="about">
|
||||
<h2 className="greeting">Hey there, I'm</h2>
|
||||
<h1 className="name">Janis Meister</h1>
|
||||
<br />
|
||||
<h3 className="job">Software Developer.</h3>
|
||||
<div className="job">
|
||||
<h3 key={job} className={`typewriter-text steps-${job.length}`}>
|
||||
{job}
|
||||
</h3>
|
||||
</div>
|
||||
<h3 className="interest">With an interest for modern technologies.</h3>
|
||||
<div className="social-links">
|
||||
<a href="https://github.com/DerTyp7" target="_blank">
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
.about {
|
||||
height: 100vh;
|
||||
padding: 5rem 10rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.greeting {
|
||||
color: var(--color-accent);
|
||||
}
|
||||
.job {
|
||||
display: flex;
|
||||
align-self: flex-start;
|
||||
text-align: left;
|
||||
}
|
||||
.interest {
|
||||
color: var(--color-font-muted);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,43 @@
|
||||
/* The typing effect */
|
||||
@keyframes typing {
|
||||
from {
|
||||
width: 0;
|
||||
}
|
||||
to {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
/* The typewriter cursor effect */
|
||||
@keyframes blink-caret {
|
||||
from,
|
||||
to {
|
||||
border-color: transparent;
|
||||
}
|
||||
50% {
|
||||
border-color: var(--color-accent);
|
||||
}
|
||||
}
|
||||
|
||||
#app {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: var(--color-background-body);
|
||||
min-height: auto;
|
||||
|
||||
.typewriter-text {
|
||||
overflow: hidden;
|
||||
border-right: 0.15em solid var(--color-accent);
|
||||
white-space: nowrap;
|
||||
letter-spacing: 0.15em;
|
||||
}
|
||||
|
||||
@for $i from 1 through 30 {
|
||||
.typewriter-text.steps-#{$i} {
|
||||
animation: typing 1s steps($i, start), blink-caret 0.75s step-end infinite;
|
||||
}
|
||||
}
|
||||
|
||||
.section {
|
||||
min-height: 100vh;
|
||||
padding: 80px 0;
|
||||
@@ -14,22 +48,5 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
// @keyframes slideIn {
|
||||
// from {
|
||||
// opacity: 0;
|
||||
// transform: translateY(20px);
|
||||
// }
|
||||
// to {
|
||||
// opacity: 1;
|
||||
// transform: translateY(0);
|
||||
// }
|
||||
// }
|
||||
|
||||
// &.active {
|
||||
// animation-name: slideIn;
|
||||
// animation-duration: 1s;
|
||||
// animation-fill-mode: forwards;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user