Skip to content

Commit 726ba8f

Browse files
committed
home optimized more
1 parent d9e2200 commit 726ba8f

File tree

5 files changed

+45
-34
lines changed

5 files changed

+45
-34
lines changed

app/page.tsx

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,48 @@
1-
import { TypewriterEffect } from '@/components/ui/typewriter-effect';
1+
import { TYPEWRITER_WORDS } from '@/constants';
22
import About from '@/components/home/About';
33
import Name from '@/components/home/Name';
4+
import { memo, Suspense } from 'react';
5+
import dynamic from 'next/dynamic';
46
import Image from 'next/image';
5-
import { memo } from 'react';
67

7-
const page = () => {
8-
const words = [
9-
{ text: "I" },
10-
{ text: "Build" },
11-
{ text: "Innovative", },
12-
{ text: "Digital", },
13-
{ text: "Solutions", },
14-
{ text: "With", },
15-
{ text: "Precision" },
16-
{ text: "And" },
17-
{ text: "Passion" },
18-
{ text: "!" },
19-
];
8+
const TypewriterEffect = dynamic(() => import('@/components/ui/typewriter-effect'), {
9+
ssr: false
10+
});
11+
12+
13+
const HomePage = () => {
2014
return (
2115
<main className='flex flex-col pt-12'>
22-
{/* Profile image for Seo */}
23-
<div className='relative'>
16+
{/* Optimized SEO Image */}
17+
<div className='relative h-0 w-0'>
2418
<Image
2519
src="/assets/profile-image.jpg"
2620
alt="Muhammed sinan - Mern stack developer"
27-
fill
28-
className="object-contain opacity-0"
29-
loading='lazy'
21+
width={1}
22+
height={1}
23+
priority={false}
24+
className="opacity-0"
3025
/>
3126
</div>
3227

33-
{/* <Hero /> */}
3428
<section className="w-full mx-auto sm:px-16 px-6 pb-10">
35-
<div className={`pb-7 mx-auto flex flex-row items-start gap-5`}>
36-
<div className="flex flex-col justify-center items-center mt-5 ml-5">
37-
</div>
29+
<div className="pb-7 mx-auto flex flex-row items-start gap-5">
3830
<div>
3931
<header>
4032
<Name />
4133
</header>
4234
<article>
43-
<TypewriterEffect words={words} />
35+
<Suspense>
36+
<TypewriterEffect words={TYPEWRITER_WORDS} />
37+
</Suspense>
4438
</article>
4539
</div>
4640
</div>
4741
</section>
4842

49-
{/* About section */}
5043
<About />
5144
</main>
5245
);
5346
};
5447

55-
export default memo(page);
48+
export default memo(HomePage);

components/home/About.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use client';
22

33
import { buttonHover, buttonVariants, containerVariants, fadeInUp, imageVariants, staggerChildren } from '@/style';
4-
import { motion } from 'framer-motion';
5-
import { memo } from 'react';
64
import { profile, thingsIDo } from '@/constants';
5+
import SocialLinks from '../SocialLinks';
6+
import { motion } from 'framer-motion';
77
import ThingsCard from './ThingsCard';
8+
import { Button } from '../ui/button';
89
import Image from 'next/image';
10+
import { memo } from 'react';
911
import Link from 'next/link';
10-
import { Button } from '../ui/button';
11-
import SocialLinks from '../SocialLinks';
1212

1313
const About = () => {
1414
return (

components/home/Name.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
'use client';
2+
23
import { profile } from '@/constants';
34
import { containerVariants } from '@/style';
45
import { motion } from 'framer-motion';
6+
import { memo } from 'react';
57

68
const Name = () => {
79
return (
@@ -16,4 +18,4 @@ const Name = () => {
1618
);
1719
};
1820

19-
export default Name;
21+
export default memo(Name);

components/ui/typewriter-effect.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import { cn } from "@/lib/utils";
44
import { motion, stagger, useAnimate, useInView } from "framer-motion";
5-
import { useEffect } from "react";
5+
import { memo, useEffect } from "react";
66

7-
export const TypewriterEffect = ({
7+
const TypewriterEffect = ({
88
words,
99
className,
1010
cursorClassName,
@@ -184,3 +184,5 @@ export const TypewriterEffectSmooth = ({
184184
</div>
185185
);
186186
};
187+
188+
export default memo(TypewriterEffect)

constants/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ export const profile = {
1717
};
1818
export const hostedUrl = "https://sinanptm.vercel.app";
1919

20+
export const TYPEWRITER_WORDS = [
21+
{ text: "I" },
22+
{ text: "Build" },
23+
{ text: "Innovative" },
24+
{ text: "Digital" },
25+
{ text: "Solutions" },
26+
{ text: "With" },
27+
{ text: "Precision" },
28+
{ text: "And" },
29+
{ text: "Passion" },
30+
{ text: "!" }
31+
];
32+
33+
2034
export const socialMediaLinks = [
2135
{
2236
title: 'LinkedIn',

0 commit comments

Comments
 (0)