From 4e4be670638dee3ba11e8a02c4e0dbb34499d838 Mon Sep 17 00:00:00 2001 From: Aman Varshney Date: Wed, 21 May 2025 10:28:06 +0530 Subject: [PATCH] fix home page icons --- .../app/(home)/_components/FeatureCard.tsx | 75 ++++++++++++++++--- .../app/(home)/_components/code-container.tsx | 2 +- apps/web/src/app/(home)/page.tsx | 4 +- 3 files changed, 68 insertions(+), 13 deletions(-) diff --git a/apps/web/src/app/(home)/_components/FeatureCard.tsx b/apps/web/src/app/(home)/_components/FeatureCard.tsx index cf6ec0c..4ab4007 100644 --- a/apps/web/src/app/(home)/_components/FeatureCard.tsx +++ b/apps/web/src/app/(home)/_components/FeatureCard.tsx @@ -3,26 +3,78 @@ import { ScrollArea } from "@/components/ui/scroll-area"; import { cn } from "@/lib/utils"; import { motion } from "motion/react"; +import { useTheme } from "next-themes"; import Image from "next/image"; +import { useEffect, useState } from "react"; -interface TechOption { +type TechOption = { id: string; name: string; icon: string; -} +}; -interface FeatureCardProps { +type FeatureCardProps = { title: string; description?: string; options: TechOption[]; className?: string; +}; + +function TechIcon({ + icon, + name, + className, +}: { + icon: string; + name: string; + className?: string; +}) { + const [mounted, setMounted] = useState(false); + const { theme } = useTheme(); + + useEffect(() => { + setMounted(true); + }, []); + + if (mounted && icon.startsWith("/icon/")) { + if ( + theme === "light" && + (icon.includes("drizzle") || + icon.includes("prisma") || + icon.includes("express")) + ) { + icon = icon.replace(".svg", "-light.svg"); + } + + return ( + {`${name} + ); + } + + return ( + + {icon} + + ); } -const FeatureCard: React.FC = ({ +export default function FeatureCard({ title, options, className, -}) => { +}: FeatureCardProps) { return ( = ({ title={option.name} className="flex items-center justify-center" > - {option.icon.startsWith("/") ? ( + {/* {option.icon.startsWith("/") ? ( {option.name} = ({ {option.icon} - )} + )} */} + ))} @@ -65,6 +122,4 @@ const FeatureCard: React.FC = ({ ); -}; - -export default FeatureCard; +} diff --git a/apps/web/src/app/(home)/_components/code-container.tsx b/apps/web/src/app/(home)/_components/code-container.tsx index ef26ff2..f29048c 100644 --- a/apps/web/src/app/(home)/_components/code-container.tsx +++ b/apps/web/src/app/(home)/_components/code-container.tsx @@ -29,7 +29,7 @@ const CodeContainer = () => {
- Choose your package manager: + Package manager:
{packageManagers.map((pm) => ( diff --git a/apps/web/src/app/(home)/page.tsx b/apps/web/src/app/(home)/page.tsx index d8284b0..5de79a1 100644 --- a/apps/web/src/app/(home)/page.tsx +++ b/apps/web/src/app/(home)/page.tsx @@ -108,9 +108,9 @@ export default function HomePage() { return ( <> -
+