Skip to content

Commit 626eb7d

Browse files
committed
fix: fixed highlighted text not rendering
1 parent 0b11e39 commit 626eb7d

File tree

2 files changed

+26
-21
lines changed

2 files changed

+26
-21
lines changed

site/src/components/About.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ArrowUpRight } from "lucide-react"
22
import BlurFade, { BLUR_FADE_DELAY } from "@/components/ui/BlurFade";
3-
import Highlight from "@/lib/highlighter";
3+
import Highlight from "@/components/ui/Highlighter";
44
import { cn } from "@/lib/utils";
55

66
const About = () => {
@@ -14,23 +14,23 @@ const About = () => {
1414
</BlurFade>
1515
<BlurFade delay={BLUR_FADE_DELAY * 4}>
1616
<p className="text-gray-700 dark:text-gray-300">
17-
I am a {Highlight("junior")} at the {Highlight("University of Waterloo")}, pursuing a major in {Highlight("Computational Mathematics")}.
18-
With a {Highlight(`passion for technology and innovation`)}, I am constantly exploring new
19-
areas in {Highlight(`software development`)} and {Highlight(`artificial intelligence`)}.
20-
I am eager to work in areas that leverage the combined potential of {Highlight(`machine learning`)} and
17+
I am a <Highlight text="junior"/> at the <Highlight text="University of Waterloo"/>, pursuing a major in <Highlight text="Computational Mathematics"/>.
18+
With a <Highlight text="passion for technology and innovation"/>, I am constantly exploring new
19+
areas in <Highlight text="software development"/> and <Highlight text="artificial intelligence"/>.
20+
I am eager to work in areas that leverage the combined potential of <Highlight text="machine learning"/> and
2121
software development, regardless of traditional boundaries. <br></br>
2222
Outside of academics and professional career, I enjoy contributing to open-source projects, working on side projects, participating in hackathons and playing
2323
table tennis, football, cricket and badminton. I also like to travel & explore new places, cuisines & restaurants.<br></br>
24-
You can find me {Highlight(`re-watching`, "pink")} any one of these TV series:
25-
{Highlight(`Suits`, "pink")},
26-
{Highlight(`The Office`, "pink")},
27-
{Highlight(`Brooklyn 9-9`, "pink")},
28-
{Highlight(`How I Met Your Mother`, "pink")},
29-
{Highlight(`The Big Bang Theory`, "pink")},
30-
{Highlight(`South Park`, "pink")},
31-
{Highlight(`Impractical Jokers`, "pink")}.
24+
You can find me <Highlight text="re-watching" color="pink"/> any one of these TV series:
25+
<Highlight text="Suits" color="pink"/>,
26+
<Highlight text="The Office" color="pink"/>,
27+
<Highlight text="Brooklyn 9-9" color="pink"/>,
28+
<Highlight text="How I Met Your Mother" color="pink"/>,
29+
<Highlight text="The Big Bang Theory" color="pink"/>,
30+
<Highlight text="South Park" color="pink"/>,
31+
<Highlight text="Impractical Jokers" color="pink"/>.
3232
<br></br>
33-
For those of you curious, the favicon is a {Highlight("4-hypercube graph", "cyan")} made via Python, using NetworkX and Matplotlib.
33+
For those of you curious, the favicon is a <Highlight text="4-hypercube graph" color="cyan" /> made via Python, using NetworkX and Matplotlib.
3434
Check the <a
3535
href="/icon.ico" target="_blank"
3636
className="inline-flex items-center hover:underline hover:underline-offset-2 text-orange-500"
Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import { cn } from "@/lib/utils";
22

3+
interface HighlightProps {
4+
text: string
5+
color?: 'cyan' | 'pink' | 'violet-web' | 'slate-blue' | 'red' | 'yellow' | 'lemon' | 'laser-lemon'
6+
}
7+
38
/**
49
* Highlights the given text with the highlighter of specified color.
510
*
@@ -8,27 +13,27 @@ import { cn } from "@/lib/utils";
813
* @returns Returns a `span` element with the highlighted text of specified color.
914
*
1015
*/
11-
export default function Highlight(text: string, color = "yellow") {
16+
export default function Highlight({ text, color = "yellow" }: HighlightProps) {
1217
let colorClass: string;
1318

1419
if (color === "cyan") {
15-
colorClass = "bg-cyan-300 dark:bg-cyan-500/30";
20+
colorClass = "bg-cyan-200 dark:bg-cyan-500/30";
1621
}
1722
else if (color === "pink" || color === "violet-web") {
18-
colorClass = "bg-[#ff77e4]";
23+
colorClass = "bg-[#ffa7ee] dark:bg-[#f73ed2]/30";
1924
}
2025
else if (color === "slate-blue") {
21-
colorClass = "bg-[#7777ff]";
26+
colorClass = "bg-[#a0a8ff] dark:bg-[#675bf9]/50";
2227
}
2328
else if (color === "red") {
24-
colorClass = "bg-[#ff7777]";
29+
colorClass = "bg-[#ffa0a0] dark:bg-[#f83b3b]/50";
2530
}
2631
else {
2732
// This covers "yellow", "lemon", "laser-lemon", and the default case
28-
colorClass = "bg-[#ffff77]";
33+
colorClass = "bg-[#ffff77] dark:bg-[#fce913]/30";
2934
}
3035

3136
return (
32-
<span className={cn("bg-opacity-50 px-1 rounded", colorClass)}>{text}</span>
37+
<span className={cn("px-1 rounded", colorClass)}>{text}</span>
3338
)
3439
}

0 commit comments

Comments
 (0)