Skip to content

Commit c0cb67c

Browse files
committed
feat: update HomeAboutMe component to use Link for external URLs and improve description formatting
1 parent ff8e642 commit c0cb67c

2 files changed

Lines changed: 19 additions & 10 deletions

File tree

src/app/(home)/sections/home-aboutme.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import Link from 'next/link';
99
export const HomeAboutMe = () => {
1010
const title = "About me!";
1111

12-
const description = `My name is <span className="text-primary font-semibold">Leat Sophat</span>, also known as <span className="text-primary font-semibold">PPhat</span>.
13-
I'm a Senior Front-end Developer at <a href="https://turbotech.com.kh/" target="_blank" rel="noopener noreferrer">TURBOTECH CO., LTD</a>, and as a Freelance UI/UX Designer.
14-
I'm from <a href="https://en.wikipedia.org/wiki/Phnom_Penh" target="_blank" rel="noopener noreferrer">Phnom Penh, Cambodia</a>.
12+
const description = <p> My name is <span className="text-primary font-semibold">Leat Sophat</span>, also known as <span className="text-primary font-semibold">PPhat</span>.
13+
I'm a Senior Front-end Developer at <Link href="https://turbotech.com.kh/" target="_blank" rel="noopener noreferrer">TURBOTECH CO., LTD</Link>, and as a Freelance UI/UX Designer.
14+
I'm from <Link href="https://en.wikipedia.org/wiki/Phnom_Penh" target="_blank" rel="noopener noreferrer">Phnom Penh, Cambodia</Link>.
1515

1616
I started my career as a Front-end Developer in 2021, and I have a passion for creating beautiful and functional user interfaces. I love to learn new technologies and improve my skills every day. I am also a big fan of open-source projects and I enjoy contributing to the community. I believe that sharing knowledge is the key to success in this field.
17-
`;
17+
</p>;
1818

1919
return (
2020
<div className="max-w-5xl flex flex-col relative items-center my-20 justify-center mx-auto">

src/components/ui/title.tsx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { cn } from "@lib/utils";
2+
import type { ReactNode } from "react";
23

34
export const Title = ({ as = 'h2', title, description, className }: {
45
as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6',
56
title: string[],
6-
description?: string
7+
description?: string | ReactNode
78
className?: string
89
}) => {
910

@@ -18,11 +19,19 @@ export const Title = ({ as = 'h2', title, description, className }: {
1819
{middleWords} <span className="text-left bg-background bg-clip-text bg-no-repeat text-transparent bg-gradient-to-r from-sky-500 via-teal-500 to-green-500 [text-shadow:0_0_rgba(0,0,0,0.1)]"> {lastWord}</span>
1920
</Heading>
2021

21-
{description && <p className="max-md:mb-0 px-5 my-5 text-left text-foreground/90 tracking-normal [&>*]:hover:transition-all [&>a]:text-primary [&>a]:hover:font-semibold"
22-
dangerouslySetInnerHTML={
23-
{ __html: description.replace(/\n/g, '<br />'), }
24-
}
25-
/>}
22+
{typeof description === 'string' && description && (
23+
<p
24+
className="max-md:mb-0 px-5 my-5 text-left text-foreground/90 tracking-normal [&>*]:hover:transition-all [&>a]:text-primary [&>a]:hover:font-semibold"
25+
dangerouslySetInnerHTML={{
26+
__html: description.replace(/\n/g, '<br />'),
27+
}}
28+
/>
29+
)}
30+
{typeof description !== 'string' && description && (
31+
<div className="max-md:mb-0 px-5 my-5 text-left text-foreground/90 tracking-normal [&>*]:hover:transition-all [&>a]:text-primary [&>a]:hover:font-semibold">
32+
{description}
33+
</div>
34+
)}
2635
</div>
2736
);
2837
}

0 commit comments

Comments
 (0)