Skip to content

Commit 3e73203

Browse files
Updated frontend text loading
1 parent 4ea24e6 commit 3e73203

9 files changed

Lines changed: 122 additions & 35 deletions

File tree

‎client/src/app/template.tsx‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@ import { motion } from "framer-motion";
44

55
export default function Template({ children }: { children: React.ReactNode}) {
66
return(
7-
<motion.div
8-
initial={{ opacity: 0, y: 20 }}
9-
animate={{ opacity: 1, y: 0 }}
10-
transition={{ ease: "easeInOut", duration: 0.5 }}
11-
>
12-
{children}
13-
</motion.div>
7+
<>
8+
{children}
9+
</>
1410
);
15-
};
11+
};

‎client/src/components/AboutMe/AboutMe.tsx‎

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
import styles from "./AboutMe.module.css";
2+
import ScrambleText from "@/components/ScrambleText/ScrambleText";
3+
import { SCRAMBLE_DURATION, GAP } from "@/lib/scrambleConfig";
4+
import { aboutContent } from "@/lib/pageContent";
25

36
export default function AboutMe() {
47

58
return(
69
<section className={styles.section} id="about">
710
<div>
8-
<h2 className={styles.heading}>
9-
About Me
10-
</h2>
11-
<p className={styles.textBlock}>
12-
I'm <strong>Seturaman</strong>, a developer based in India (IIT BHU)
13-
currently a student. I finished studying Full Stack in Decemeber 2025.
14-
I just started moving away from frontend to <strong>Backend and DevOps. </strong>
15-
I have used AWS before and worked with <strong>EC2 and S3.</strong>
16-
</p>
11+
<ScrambleText as="h1" text={aboutContent.heading} className={styles.heading} delay={0}/>
12+
<ScrambleText as="p" text={aboutContent.intro} className={styles.textBlock} delay={SCRAMBLE_DURATION + GAP}/>
1713
</div>
1814
<div className={styles.bentoGrid}>
1915
<div className={`${styles.bentoBox} ${styles.wide} ${styles.mobileHidden}`}>
@@ -45,14 +41,9 @@ export default function AboutMe() {
4541
</div>
4642
</div>
4743
<div className={styles.textBlock}>
48-
<p>
49-
Beyond the frontend, I find the backend and DevOps logic quite
50-
interesting. Moving away from frontend I have learned <strong>Terraform,
51-
Ansible, Nginx and Monit</strong> for DevOps. And started learning <strong>Django </strong>
52-
for creating newer projects to start integrating AI/ML.
53-
</p>
44+
<ScrambleText as="p" text={aboutContent.outro} delay={SCRAMBLE_DURATION * 2 + GAP}/>
5445
</div>
5546
</section>
5647
)
5748

58-
}
49+
}

‎client/src/components/ContactMe/ContactMe.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import { useState, useEffect } from "react";
44
import styles from "./ContactMe.module.css";
5+
import ScrambleText from "@/components/ScrambleText/ScrambleText";
6+
import { contactContent } from "@/lib/pageContent";
57

68
export default function ContactMe() {
79

@@ -55,7 +57,7 @@ export default function ContactMe() {
5557

5658
return(
5759
<section className={styles.container}>
58-
<h2 className={styles.title}>Get In Touch</h2>
60+
<ScrambleText as="h2" text={contactContent.heading} className={styles.title} delay={0}/>
5961
<div className={styles.cardGrid}>
6062
<a
6163
href="https://github.com/SeturamanKumar"

‎client/src/components/Hero/Hero.tsx‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import styles from "./Hero.module.css";
2+
import ScrambleText from "@/components/ScrambleText/ScrambleText";
3+
import { SCRAMBLE_DURATION, GAP } from "@/lib/scrambleConfig";
4+
import { heroContent } from "@/lib/pageContent";
25

36
export default function Hero() {
47
return (
58
<section className={styles.hero}>
6-
<h1 className={styles.name}>
7-
Seturaman Kumar
8-
</h1>
9-
<p className={styles.title}>
10-
Full Stack Developer
11-
</p>
9+
<ScrambleText as="h1" text={heroContent.name} className={styles.name} delay={0}/>
10+
<ScrambleText as="p" text={heroContent.title} className={styles.title} delay={SCRAMBLE_DURATION + GAP}/>
11+
1212
<a
13-
href="https://maps.app.goo.gl/rEZX88Bywc9zXqr77"
13+
href={heroContent.locationUrl}
1414
target="_blank"
1515
rel="noopener noreferrer"
1616
className={styles.locationLink}>
17-
<span>Based In India (IIT BHU)</span>
17+
<ScrambleText as="span" text={heroContent.location} delay={SCRAMBLE_DURATION * 2 + GAP}/>
1818
<svg
1919
width="18"
2020
height="18"

‎client/src/components/ProjectsMe/ProjectsMe.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import styles from "./ProjectsMe.module.css";
22
import ProjectCard from "../ProjectCard/ProjectCard";
3+
import ScrambleText from "@/components/ScrambleText/ScrambleText";
4+
import { SCRAMBLE_DURATION } from "@/lib/scrambleConfig";
5+
import { projectsContent } from "@/lib/pageContent";
36

47
const projects = [
58
{
@@ -42,7 +45,7 @@ export default function Projects() {
4245
return (
4346
<section className={styles.section} id="projects">
4447
<div className={styles.container}>
45-
<h2 className={styles.heading}>Featured Projects</h2>
48+
<ScrambleText as="h2" text={projectsContent.heading} className={styles.heading} delay={0}/>
4649
<div className={styles.grid}>
4750
{
4851
projects.map((project, index) => (
@@ -56,4 +59,4 @@ export default function Projects() {
5659
</div>
5760
</section>
5861
);
59-
}
62+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"use client";
2+
3+
import { useScramble } from "@/hooks/useScramble";
4+
5+
interface ScrambleTextProps {
6+
text: string;
7+
delay?: number;
8+
className?: string;
9+
as?: keyof JSX.IntrinsicElements;
10+
}
11+
12+
export default function ScrambleText({ text, delay = 0, className, as: Tag = "span", }: ScrambleTextProps) {
13+
const display = useScramble(text, delay);
14+
15+
return <Tag className={className}>{display}</Tag>
16+
}

‎client/src/hooks/useScramble.ts‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
"use client";
2+
import { useEffect, useState, useRef } from "react";
3+
import { SCRAMBLE_DURATION } from "@/lib/scrambleConfig";
4+
5+
const CHARSET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*";
6+
const FRAME_INTERVAL = 15;
7+
8+
function randomChar(): string {
9+
return CHARSET[Math.floor(Math.random() * CHARSET.length)];
10+
}
11+
12+
export function useScramble(text: string, delay: number = 0) {
13+
const [display, setDisplay] = useState("");
14+
const frameRef = useRef<ReturnType<typeof setTimeout> | null>(null);
15+
const startRef = useRef<number | null>(null);
16+
17+
useEffect(() => {
18+
if(!text) return;
19+
20+
setDisplay("");
21+
22+
const delayTimer = setTimeout(() => {
23+
startRef.current = performance.now();
24+
25+
function tick() {
26+
const elapsed = performance.now() - (startRef.current ?? 0);
27+
const progress = Math.min(elapsed / SCRAMBLE_DURATION, 1);
28+
const resolvedCount = Math.floor(progress * text.length);
29+
30+
setDisplay(
31+
text
32+
.split("")
33+
.map((char, i) => {
34+
if (char === " ") return " ";
35+
if (i < resolvedCount) return char;
36+
if (i === resolvedCount) return randomChar();
37+
return "";
38+
})
39+
.join("")
40+
);
41+
42+
if (progress < 1) {
43+
frameRef.current = setTimeout(tick, FRAME_INTERVAL);
44+
}
45+
}
46+
47+
tick();
48+
}, delay);
49+
50+
return () => {
51+
clearTimeout(delayTimer);
52+
if (frameRef.current) clearTimeout(frameRef.current);
53+
};
54+
}, [text, delay]);
55+
56+
return display;
57+
}

‎client/src/lib/pageContent.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export const heroContent = {
2+
name: "Seturaman Kumar",
3+
title: "Full Stack Developer",
4+
location: "Based in India (IIT BHU)",
5+
locationUrl: "https://maps.app.goo.gl/rEZX88Bywc9zXqr77",
6+
};
7+
8+
export const aboutContent = {
9+
heading: "About Me",
10+
intro: "I'm Seturaman, a developer based in India (IIT BHU) currently a student. I finished studying Full Stack in Decemeber 2025. I just started moving away from frontend to Backend and DevOps. I have used AWS before and worked with EC2 and S3.",
11+
outro: "Beyond the frontend, I find the backend and DevOps logic quite interesting. Moving away from frontend I have learned Terraform, Ansible, Nginx and Monit for DevOps. And started learning Django for creating newer projects to start integrating AI/ML.",
12+
};
13+
14+
export const projectsContent = {
15+
heading: "Featured Projects",
16+
};
17+
18+
export const contactContent = {
19+
heading: "Get in Touch",
20+
};

‎client/src/lib/scrambleConfig.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const SCRAMBLE_DURATION = 700;
2+
export const GAP = 100;

0 commit comments

Comments
 (0)