refactor(ui): update UI components and navigation

- Improve header, hero, and login modal components
- Update command menu functionality
- Enhance magic card component
This commit is contained in:
Thomas Camlong
2025-11-07 08:11:18 +01:00
parent 56289820f0
commit 4b001dc758
5 changed files with 31 additions and 50 deletions

View File

@@ -68,11 +68,7 @@ export function CommandMenu({ icons, open: externalOpen, onOpenChange: externalO
return ( return (
<CommandDialog open={isOpen} onOpenChange={setIsOpen} contentClassName="bg-background/90 backdrop-blur-sm border border-border/60"> <CommandDialog open={isOpen} onOpenChange={setIsOpen} contentClassName="bg-background/90 backdrop-blur-sm border border-border/60">
<CommandInput <CommandInput placeholder={`Search our collection of ${totalIcons} icons by name...`} value={query} onValueChange={setQuery} />
placeholder={`Search our collection of ${totalIcons} icons by name...`}
value={query}
onValueChange={setQuery}
/>
<CommandList className="max-h-[300px]"> <CommandList className="max-h-[300px]">
{/* Icon Results */} {/* Icon Results */}
<CommandGroup heading="Icons"> <CommandGroup heading="Icons">

View File

@@ -2,8 +2,8 @@
import { Github, LayoutDashboard, LogOut, PlusCircle, Search, Star } from "lucide-react" import { Github, LayoutDashboard, LogOut, PlusCircle, Search, Star } from "lucide-react"
import Link from "next/link" import Link from "next/link"
import { useEffect, useState } from "react"
import { usePostHog } from "posthog-js/react" import { usePostHog } from "posthog-js/react"
import { useEffect, useState } from "react"
import { LoginModal } from "@/components/login-modal" import { LoginModal } from "@/components/login-modal"
import { ThemeSwitcher } from "@/components/theme-switcher" import { ThemeSwitcher } from "@/components/theme-switcher"
import { REPO_NAME, REPO_PATH } from "@/constants" import { REPO_NAME, REPO_PATH } from "@/constants"
@@ -185,13 +185,21 @@ export function Header() {
<div className="hidden md:flex items-center gap-2 md:gap-4"> <div className="hidden md:flex items-center gap-2 md:gap-4">
{isLoggedIn ? ( {isLoggedIn ? (
<Button variant="outline" className="hidden md:inline-flex cursor-pointer transition-all duration-300 items-center gap-2" asChild> <Button
variant="outline"
className="hidden md:inline-flex cursor-pointer transition-all duration-300 items-center gap-2"
asChild
>
<Link href="/submit"> <Link href="/submit">
<PlusCircle className="h-4 w-4 transition-all duration-300" /> Submit icon(s) <PlusCircle className="h-4 w-4 transition-all duration-300" /> Submit icon(s)
</Link> </Link>
</Button> </Button>
) : ( ) : (
<Button variant="outline" className="hidden md:inline-flex cursor-pointer transition-all duration-300 items-center gap-2" onClick={handleSubmitClick}> <Button
variant="outline"
className="hidden md:inline-flex cursor-pointer transition-all duration-300 items-center gap-2"
onClick={handleSubmitClick}
>
<PlusCircle className="h-4 w-4 transition-all duration-300" /> Submit icon(s) <PlusCircle className="h-4 w-4 transition-all duration-300" /> Submit icon(s)
</Button> </Button>
)} )}

View File

@@ -114,7 +114,7 @@ function ElegantShape({
y: [0, 15, 0], y: [0, 15, 0],
}} }}
transition={{ transition={{
duration: 8 + Math.random() * 4, // Random duration between 8-12s for varied movement duration: 8,
repeat: Number.POSITIVE_INFINITY, repeat: Number.POSITIVE_INFINITY,
ease: "easeInOut", ease: "easeInOut",
repeatType: "reverse", repeatType: "reverse",

View File

@@ -1,9 +1,9 @@
"use client" "use client"
import { Github, Loader2 } from "lucide-react" import { Github, Loader2 } from "lucide-react"
import { usePostHog } from "posthog-js/react"
import type React from "react" import type React from "react"
import { useRef, useState } from "react" import { useRef, useState } from "react"
import { usePostHog } from "posthog-js/react"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog" import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog"
import { Input } from "@/components/ui/input" import { Input } from "@/components/ui/input"
@@ -110,14 +110,9 @@ export function LoginModal({ open, onOpenChange }: LoginModalProps) {
<Dialog open={open} onOpenChange={onOpenChange}> <Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="w-full max-w-lg bg-background border shadow-2xl"> <DialogContent className="w-full max-w-lg bg-background border shadow-2xl">
<DialogHeader className="text-center space-y-2 pb-4"> <DialogHeader className="text-center space-y-2 pb-4">
<DialogTitle className="text-3xl font-bold"> <DialogTitle className="text-3xl font-bold">{isRegister ? "Create Account" : "Welcome Back"}</DialogTitle>
{isRegister ? "Create Account" : "Welcome Back"}
</DialogTitle>
<DialogDescription className="text-lg text-muted-foreground"> <DialogDescription className="text-lg text-muted-foreground">
{isRegister {isRegister ? "Join our community and start submitting icons" : "Sign in to submit and manage your icons"}
? "Join our community and start submitting icons"
: "Sign in to submit and manage your icons"
}
</DialogDescription> </DialogDescription>
</DialogHeader> </DialogHeader>
@@ -137,12 +132,7 @@ export function LoginModal({ open, onOpenChange }: LoginModalProps) {
)} )}
{/* GitHub Button (Coming Soon) */} {/* GitHub Button (Coming Soon) */}
<Button <Button type="button" variant="outline" className="w-full h-12 text-base font-medium cursor-not-allowed opacity-50" disabled>
type="button"
variant="outline"
className="w-full h-12 text-base font-medium cursor-not-allowed opacity-50"
disabled
>
<Github className="h-5 w-5 mr-2" /> <Github className="h-5 w-5 mr-2" />
Continue with GitHub Continue with GitHub
<span className="ml-2 text-xs text-muted-foreground">(Coming soon)</span> <span className="ml-2 text-xs text-muted-foreground">(Coming soon)</span>
@@ -176,9 +166,7 @@ export function LoginModal({ open, onOpenChange }: LoginModalProps) {
required required
/> />
{isRegister && ( {isRegister && (
<p className="text-xs text-muted-foreground"> <p className="text-xs text-muted-foreground">We'll only use this to send you updates about your submissions</p>
We'll only use this to send you updates about your submissions
</p>
)} )}
</div> </div>
@@ -198,9 +186,7 @@ export function LoginModal({ open, onOpenChange }: LoginModalProps) {
className="h-12 text-base" className="h-12 text-base"
required required
/> />
<p className="text-xs text-muted-foreground"> <p className="text-xs text-muted-foreground">This will be displayed publicly with your submissions</p>
This will be displayed publicly with your submissions
</p>
</div> </div>
)} )}
@@ -242,11 +228,7 @@ export function LoginModal({ open, onOpenChange }: LoginModalProps) {
</div> </div>
{/* Submit Button */} {/* Submit Button */}
<Button <Button type="submit" className="w-full h-12 text-base font-semibold" disabled={isLoading}>
type="submit"
className="w-full h-12 text-base font-semibold"
disabled={isLoading}
>
{isLoading ? ( {isLoading ? (
<> <>
<Loader2 className="h-5 w-5 mr-2 animate-spin" /> <Loader2 className="h-5 w-5 mr-2 animate-spin" />
@@ -264,10 +246,7 @@ export function LoginModal({ open, onOpenChange }: LoginModalProps) {
onClick={toggleMode} onClick={toggleMode}
className="text-sm text-muted-foreground hover:text-foreground transition-colors font-medium hover:underline underline-offset-4" className="text-sm text-muted-foreground hover:text-foreground transition-colors font-medium hover:underline underline-offset-4"
> >
{isRegister {isRegister ? "Already have an account? Sign in" : "Don't have an account? Create one"}
? "Already have an account? Sign in"
: "Don't have an account? Create one"
}
</button> </button>
</div> </div>
</form> </form>

View File

@@ -1,11 +1,10 @@
"use client" "use client"
import { motion, useMotionTemplate, useMotionValue } from "motion/react" import { motion, useMotionTemplate, useMotionValue } from "motion/react"
import { useTheme } from "next-themes"
import type React from "react" import type React from "react"
import { useCallback, useEffect, useRef, useState } from "react" import { useCallback, useEffect, useRef, useState } from "react"
import { cn } from "@/lib/utils" import { cn } from "@/lib/utils"
import { useTheme } from "next-themes"
interface MagicCardProps { interface MagicCardProps {
children?: React.ReactNode children?: React.ReactNode
@@ -30,7 +29,6 @@ export function MagicCard({
const mouseX = useMotionValue(-gradientSize) const mouseX = useMotionValue(-gradientSize)
const mouseY = useMotionValue(-gradientSize) const mouseY = useMotionValue(-gradientSize)
const handleMouseMove = useCallback( const handleMouseMove = useCallback(
(e: MouseEvent) => { (e: MouseEvent) => {
if (cardRef.current) { if (cardRef.current) {