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 "@styles/About.scss";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
export default function About() {
|
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 (
|
return (
|
||||||
<div className="about">
|
<div className="about">
|
||||||
<h2 className="greeting">Hey there, I'm</h2>
|
<h2 className="greeting">Hey there, I'm</h2>
|
||||||
<h1 className="name">Janis Meister</h1>
|
<h1 className="name">Janis Meister</h1>
|
||||||
<br />
|
<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>
|
<h3 className="interest">With an interest for modern technologies.</h3>
|
||||||
<div className="social-links">
|
<div className="social-links">
|
||||||
<a href="https://github.com/DerTyp7" target="_blank">
|
<a href="https://github.com/DerTyp7" target="_blank">
|
||||||
|
|||||||
@@ -1,9 +1,17 @@
|
|||||||
.about {
|
.about {
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
padding: 5rem 10rem;
|
padding: 5rem 10rem;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
.greeting {
|
.greeting {
|
||||||
color: var(--color-accent);
|
color: var(--color-accent);
|
||||||
}
|
}
|
||||||
|
.job {
|
||||||
|
display: flex;
|
||||||
|
align-self: flex-start;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
.interest {
|
.interest {
|
||||||
color: var(--color-font-muted);
|
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 {
|
#app {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
background-color: var(--color-background-body);
|
background-color: var(--color-background-body);
|
||||||
min-height: auto;
|
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 {
|
.section {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
padding: 80px 0;
|
padding: 80px 0;
|
||||||
@@ -14,22 +48,5 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: 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