From 53a3832fc4324a48e14fd2de9b163cc0984d8eba Mon Sep 17 00:00:00 2001 From: Timothy Pidashev Date: Mon, 18 Mar 2024 22:35:00 -0700 Subject: [PATCH] Change color for each tab in animation --- src/web/src/components/header.jsx | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/web/src/components/header.jsx b/src/web/src/components/header.jsx index 74148b5..209ffb6 100644 --- a/src/web/src/components/header.jsx +++ b/src/web/src/components/header.jsx @@ -7,13 +7,21 @@ import { useState, useEffect } from "react"; let tabs = [ - { id: "/", label: "Home" }, - { id: "projects", label: "Projects" }, - { id: "resume", label: "Resume" }, - { id: "blog", label: "Blog" }, - { id: "shop", label: "Shop" }, + { id: "/", label: "Home", color: "green" }, + { id: "projects", label: "Projects", color: "yellow" }, + { id: "resume", label: "Resume", color: "blue" }, + { id: "blog", label: "Blog", color: "purple" }, + { id: "shop", label: "Shop", color: "aqua" } ]; +const tabColors = { + "green": "bg-light-green-1 dark:bg-dark-green-1", + "yellow": "bg-light-yellow-1 dark:bg-dark-yellow-1", + "blue": "bg-light-blue-1 dark:bg-dark-blue-1", + "purple": "bg-light-purple-1 dark:bg-dark-purple-1", + "aqua": "bg-light-aqua-1 dark:bg-dark-aqua-1" +} + function Header() { const [mounted, setMounted] = useState(false); let [activeTab, setActiveTab] = useState(tabs[0].id); @@ -43,7 +51,7 @@ function Header() { onClick={() => setActiveTab(tab.id)} className={`${ activeTab === tab.id ? "" : "hover:text-white/60" - } relative rounded-full px-3 py-1.5 text-sm font-medium text-light-foreground dark:text-dark-foreground outline-sky-400 transition focus-visible:outline-2`} + } relative rounded-full px-3 py-1.5 text-sm text-light-foreground dark:text-dark-foreground outline-sky-400 transition focus-visible:outline-2`} style={{ WebkitTapHighlightColor: "transparent", }} @@ -51,7 +59,7 @@ function Header() { {activeTab === tab.id && ( @@ -60,6 +68,7 @@ function Header() { ))} + );