|
| 1 | +import ExternalLink from "@/components/ExternalLink"; |
| 2 | +import FOOTER from "@/components/FOOTER"; |
| 3 | +import MENU from "@/components/MENU"; |
| 4 | +import { friends, siteUrl } from "@/lib/defs"; |
| 5 | +import { safeJsonLd } from "@/lib/jsonld"; |
| 6 | +import { Metadata } from "next"; |
| 7 | +import Image from "next/image"; |
| 8 | +import Script from "next/script"; |
| 9 | + |
| 10 | +export const metadata: Metadata = { |
| 11 | + title: "Friends", |
| 12 | + description: |
| 13 | + "Some of the super cool people I have the privilege to call friends.", |
| 14 | + alternates: { |
| 15 | + canonical: "https://jaspermayone.com/friends", |
| 16 | + }, |
| 17 | +}; |
| 18 | + |
| 19 | +const friendsPageSchema = { |
| 20 | + "@context": "https://schema.org", |
| 21 | + "@graph": [ |
| 22 | + { |
| 23 | + "@type": "WebPage", |
| 24 | + "@id": "https://jaspermayone.com/friends#webpage", |
| 25 | + url: "https://jaspermayone.com/friends", |
| 26 | + name: "Friends - Jasper Mayone", |
| 27 | + description: |
| 28 | + "Some of the super cool people I have the privilege to call friends.", |
| 29 | + isPartOf: { |
| 30 | + "@id": "https://jaspermayone.com/#website", |
| 31 | + }, |
| 32 | + about: { |
| 33 | + "@id": "https://jaspermayone.com/#person", |
| 34 | + }, |
| 35 | + mainEntity: { |
| 36 | + "@id": "https://jaspermayone.com/friends#friend-list", |
| 37 | + }, |
| 38 | + breadcrumb: { |
| 39 | + "@type": "BreadcrumbList", |
| 40 | + "@id": "https://jaspermayone.com/friends#breadcrumb", |
| 41 | + itemListElement: [ |
| 42 | + { |
| 43 | + "@type": "ListItem", |
| 44 | + position: 1, |
| 45 | + name: "Home", |
| 46 | + item: "https://jaspermayone.com", |
| 47 | + }, |
| 48 | + { |
| 49 | + "@type": "ListItem", |
| 50 | + position: 2, |
| 51 | + name: "Friends", |
| 52 | + item: "https://jaspermayone.com/friends", |
| 53 | + }, |
| 54 | + ], |
| 55 | + }, |
| 56 | + }, |
| 57 | + { |
| 58 | + "@type": "ItemList", |
| 59 | + "@id": "https://jaspermayone.com/friends#friend-list", |
| 60 | + name: "Friends", |
| 61 | + description: "Friends of Jasper Mayone", |
| 62 | + numberOfItems: friends.length, |
| 63 | + itemListElement: friends.map((friend, index) => ({ |
| 64 | + "@type": "ListItem", |
| 65 | + position: index + 1, |
| 66 | + item: { |
| 67 | + "@type": "Person", |
| 68 | + name: friend.name, |
| 69 | + ...(friend.image ? { image: `${siteUrl}${friend.image}` } : {}), |
| 70 | + ...(friend.link ? { url: friend.link } : {}), |
| 71 | + }, |
| 72 | + })), |
| 73 | + }, |
| 74 | + ], |
| 75 | +}; |
| 76 | + |
| 77 | +function initials(name: string): string { |
| 78 | + const words = name.split(" "); |
| 79 | + const first = words[0]?.[0] ?? ""; |
| 80 | + const last = words.length > 1 ? (words[words.length - 1][0] ?? "") : ""; |
| 81 | + return `${first}${last}`.toUpperCase(); |
| 82 | +} |
| 83 | + |
| 84 | +export default function Friends() { |
| 85 | + return ( |
| 86 | + <> |
| 87 | + <Script |
| 88 | + id="friends-schema" |
| 89 | + type="application/ld+json" |
| 90 | + dangerouslySetInnerHTML={{ |
| 91 | + __html: safeJsonLd(friendsPageSchema), |
| 92 | + }} |
| 93 | + /> |
| 94 | + <div className="flex min-h-screen flex-col"> |
| 95 | + <MENU pageFirstWord="Friends" /> |
| 96 | + <main className="flex-1"> |
| 97 | + <div className="mx-5 mt-4 mb-4"> |
| 98 | + <h1 |
| 99 | + className="mb-2 text-xl font-semibold text-zinc-800 dark:text-white" |
| 100 | + style={{ fontFamily: "var(--font-balgin)" }} |
| 101 | + > |
| 102 | + Friends |
| 103 | + </h1> |
| 104 | + <p className="mb-6 text-zinc-600 dark:text-white/70"> |
| 105 | + I have some super cool friends, check them all out! 🌟 (btw, shoot |
| 106 | + me a message if you want to be added here, I definitely missed |
| 107 | + some people lol.) |
| 108 | + </p> |
| 109 | + |
| 110 | + <div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5"> |
| 111 | + {friends.map((friend) => { |
| 112 | + const card = ( |
| 113 | + <> |
| 114 | + {friend.image ? ( |
| 115 | + <Image |
| 116 | + src={friend.image} |
| 117 | + alt={friend.name} |
| 118 | + width={400} |
| 119 | + height={400} |
| 120 | + className="aspect-square w-full rounded-lg object-cover" |
| 121 | + /> |
| 122 | + ) : ( |
| 123 | + <div |
| 124 | + aria-hidden |
| 125 | + className="flex aspect-square w-full items-center justify-center rounded-lg bg-[#56ba8e]/15 text-4xl font-semibold text-[#3d8a68] dark:bg-[#56ba8e]/10 dark:text-[#7ccfa9]" |
| 126 | + style={{ fontFamily: "var(--font-balgin)" }} |
| 127 | + > |
| 128 | + {initials(friend.name)} |
| 129 | + </div> |
| 130 | + )} |
| 131 | + <p className="mt-2 text-sm font-medium text-zinc-800 dark:text-zinc-100"> |
| 132 | + {friend.name} |
| 133 | + </p> |
| 134 | + </> |
| 135 | + ); |
| 136 | + |
| 137 | + return friend.link ? ( |
| 138 | + <ExternalLink |
| 139 | + key={friend.name} |
| 140 | + href={friend.link} |
| 141 | + className="group rounded-lg transition-opacity hover:opacity-80" |
| 142 | + > |
| 143 | + {card} |
| 144 | + </ExternalLink> |
| 145 | + ) : ( |
| 146 | + <div key={friend.name}>{card}</div> |
| 147 | + ); |
| 148 | + })} |
| 149 | + </div> |
| 150 | + </div> |
| 151 | + </main> |
| 152 | + <FOOTER /> |
| 153 | + </div> |
| 154 | + </> |
| 155 | + ); |
| 156 | +} |
0 commit comments