|
| 1 | +import Head from 'next/head'; |
| 2 | +import Image from 'next/image'; |
| 3 | + |
| 4 | +const characters = [ |
| 5 | + { |
| 6 | + src: '/characters/dolful.png', |
| 7 | + alt: 'Dolful Character', |
| 8 | + name: 'Dolful', |
| 9 | + description: 'Brave, optimistic, sometimes cheeky', |
| 10 | + }, |
| 11 | + { |
| 12 | + src: '/characters/dolphina.png', |
| 13 | + alt: 'Dolphina Character', |
| 14 | + name: 'Dolphina', |
| 15 | + description: 'Kind, nurturing, voice of reason, balances Dolful’s boldness', |
| 16 | + }, |
| 17 | + { |
| 18 | + src: '/characters/quacky.png', |
| 19 | + alt: 'Quacky Character', |
| 20 | + name: 'Quacky', |
| 21 | + description: 'Mischievous, silly, comic relief, always tagging along', |
| 22 | + }, |
| 23 | + { |
| 24 | + src: '/characters/sealina.png', |
| 25 | + alt: 'Sealina Character', |
| 26 | + name: 'Sealina', |
| 27 | + description: 'Fun, loyal, energetic, encourages Dolphina but sometimes drags her into silly adventures', |
| 28 | + }, |
| 29 | + { |
| 30 | + src: '/characters/whaly.png', |
| 31 | + alt: 'Whaly Character', |
| 32 | + name: 'Whaly', |
| 33 | + description: 'Big-hearted but clumsy, often causes chaos unintentionally', |
| 34 | + }, |
| 35 | + { |
| 36 | + src: '/characters/sharkful.png', |
| 37 | + alt: 'Sharkful Character', |
| 38 | + name: 'Sharkful', |
| 39 | + description: 'Confident, competitive, sometimes mean ', |
| 40 | + }, |
| 41 | +]; |
| 42 | + |
| 43 | +export default function CharactersPage() { |
| 44 | + const handleDownload = (src: string, name: string) => { |
| 45 | + const link = document.createElement('a'); |
| 46 | + link.href = src; |
| 47 | + link.download = name.toLowerCase().replace(/\s+/g, '-') + '.png'; |
| 48 | + document.body.appendChild(link); |
| 49 | + link.click(); |
| 50 | + document.body.removeChild(link); |
| 51 | + }; |
| 52 | + |
| 53 | + return ( |
| 54 | + <div className="max-w-7xl mx-auto px-4 py-8 sm:px-6 lg:px-8"> |
| 55 | + <Head> |
| 56 | + <title>Characters | LuckyUI</title> |
| 57 | + <meta name="description" content="Meet the LuckyUI characters" /> |
| 58 | + </Head> |
| 59 | + |
| 60 | + <div className="mb-12"> |
| 61 | + <h1 className="text-3xl font-bold mb-2">Characters</h1> |
| 62 | + </div> |
| 63 | + |
| 64 | + <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6"> |
| 65 | + {characters.map((character) => ( |
| 66 | + <div key={character.src} className="border rounded-lg overflow-hidden flex flex-col h-full"> |
| 67 | + <div className="p-6 flex-grow flex items-center justify-center min-h-[200px] bg-white"> |
| 68 | + <Image |
| 69 | + src={character.src} |
| 70 | + alt={character.alt} |
| 71 | + width={200} |
| 72 | + height={200} |
| 73 | + className="object-contain max-w-full h-auto" |
| 74 | + /> |
| 75 | + </div> |
| 76 | + <div className="p-4 border-t"> |
| 77 | + <h3 className="text-lg font-medium mb-1">{character.name}</h3> |
| 78 | + <p className="text-sm mb-4">{character.description}</p> |
| 79 | + <button |
| 80 | + onClick={() => handleDownload(character.src, character.name)} |
| 81 | + className="w-full py-2 px-4 border rounded-md text-sm font-medium hover:bg-gray-50 transition-colors cursor-pointer" |
| 82 | + > |
| 83 | + Download |
| 84 | + </button> |
| 85 | + </div> |
| 86 | + </div> |
| 87 | + ))} |
| 88 | + </div> |
| 89 | + </div> |
| 90 | + ); |
| 91 | +} |
0 commit comments