mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
fix home page icons
This commit is contained in:
@@ -3,26 +3,78 @@
|
|||||||
import { ScrollArea } from "@/components/ui/scroll-area";
|
import { ScrollArea } from "@/components/ui/scroll-area";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { motion } from "motion/react";
|
import { motion } from "motion/react";
|
||||||
|
import { useTheme } from "next-themes";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
interface TechOption {
|
type TechOption = {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
icon: string;
|
icon: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
interface FeatureCardProps {
|
type FeatureCardProps = {
|
||||||
title: string;
|
title: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
options: TechOption[];
|
options: TechOption[];
|
||||||
className?: string;
|
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 (
|
||||||
|
<Image
|
||||||
|
src={icon}
|
||||||
|
alt={`${name} icon`}
|
||||||
|
width={24}
|
||||||
|
height={24}
|
||||||
|
className={cn("h-6 w-6 object-contain", className)}
|
||||||
|
unoptimized
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
className={cn(
|
||||||
|
"flex h-6 w-6 items-center justify-center text-2xl",
|
||||||
|
className,
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{icon}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const FeatureCard: React.FC<FeatureCardProps> = ({
|
export default function FeatureCard({
|
||||||
title,
|
title,
|
||||||
options,
|
options,
|
||||||
className,
|
className,
|
||||||
}) => {
|
}: FeatureCardProps) {
|
||||||
return (
|
return (
|
||||||
<motion.div
|
<motion.div
|
||||||
className={cn(
|
className={cn(
|
||||||
@@ -45,7 +97,7 @@ const FeatureCard: React.FC<FeatureCardProps> = ({
|
|||||||
title={option.name}
|
title={option.name}
|
||||||
className="flex items-center justify-center"
|
className="flex items-center justify-center"
|
||||||
>
|
>
|
||||||
{option.icon.startsWith("/") ? (
|
{/* {option.icon.startsWith("/") ? (
|
||||||
<Image
|
<Image
|
||||||
src={option.icon}
|
src={option.icon}
|
||||||
alt={option.name}
|
alt={option.name}
|
||||||
@@ -57,7 +109,12 @@ const FeatureCard: React.FC<FeatureCardProps> = ({
|
|||||||
<span className="flex h-6 w-6 items-center justify-center text-2xl">
|
<span className="flex h-6 w-6 items-center justify-center text-2xl">
|
||||||
{option.icon}
|
{option.icon}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)} */}
|
||||||
|
<TechIcon
|
||||||
|
icon={option.icon}
|
||||||
|
name={option.name}
|
||||||
|
className="h-6 w-6 object-contain"
|
||||||
|
/>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
@@ -65,6 +122,4 @@ const FeatureCard: React.FC<FeatureCardProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|
||||||
export default FeatureCard;
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ const CodeContainer = () => {
|
|||||||
<div className="overflow-hidden rounded-lg border border-border bg-muted/30 shadow-sm">
|
<div className="overflow-hidden rounded-lg border border-border bg-muted/30 shadow-sm">
|
||||||
<div className="flex items-center justify-between border-border border-b bg-muted/50 px-4 py-2">
|
<div className="flex items-center justify-between border-border border-b bg-muted/50 px-4 py-2">
|
||||||
<span className="text-muted-foreground text-xs">
|
<span className="text-muted-foreground text-xs">
|
||||||
Choose your package manager:
|
Package manager:
|
||||||
</span>
|
</span>
|
||||||
<div className="flex items-center rounded-md border border-border bg-background p-0.5">
|
<div className="flex items-center rounded-md border border-border bg-background p-0.5">
|
||||||
{packageManagers.map((pm) => (
|
{packageManagers.map((pm) => (
|
||||||
|
|||||||
@@ -108,9 +108,9 @@ export default function HomePage() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Navbar />
|
<Navbar />
|
||||||
<main className="flex min-h-screen flex-col items-center justify-center overflow-x-hidden bg-background px-4 pt-24 pb-10 sm:px-6 md:px-8 md:pt-28 lg:pt-32">
|
<main className="flex min-h-svh flex-col items-center justify-center overflow-x-hidden bg-background px-4 pt-24 pb-10 sm:px-6 md:px-8 md:pt-28 lg:pt-32">
|
||||||
<motion.div
|
<motion.div
|
||||||
className="relative z-10 mx-auto mb-12 w-full max-w-6xl sm:mb-16"
|
className="mx-auto mb-12 w-full max-w-6xl sm:mb-16"
|
||||||
initial="hidden"
|
initial="hidden"
|
||||||
animate="visible"
|
animate="visible"
|
||||||
variants={containerVariants}
|
variants={containerVariants}
|
||||||
|
|||||||
Reference in New Issue
Block a user