import { Link, useLoaderData } from "react-router"; import { listBands, listArtists, listBandLists, listRecentBands, listRecentArtists } from "~/lib/db.server"; export function loader() { return { bandCount: listBands().length, artistCount: listArtists().length, listCount: listBandLists().length, recentBands: listRecentBands(8), recentArtists: listRecentArtists(8), }; } export default function Home() { const { bandCount, artistCount, listCount, recentBands, recentArtists } = useLoaderData(); return (

whois.band

バンドとアーティストの情報管理サイト

{recentBands.length === 0 ? (

まだありません

) : (
    {recentBands.map((band) => (
  • {band.name} {band.status === "hiatus" && ( 活動休止 )}
  • ))}
)}
{recentArtists.length === 0 ? (

まだありません

) : (
    {recentArtists.map((artist) => (
  • {artist.name}
  • ))}
)}
); } function SectionRow({ to, label, count, newTo, }: { to: string; label: string; count: number; newTo: string; }) { return (
{label} {count}件
+ 追加
); } function RecentSection({ title, viewAllTo, children, }: { title: string; viewAllTo: string; children: React.ReactNode; }) { return (

{title}

すべて見る
{children}
); }