Files

49 lines
2.0 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { ResourceCard } from "./components/ResourceCard";
import {
Alert,
AlertDescription,
AlertTitle,
} from "@/components/ui/alert"
import { ResourceAPI } from "@/lib/api/server";
import { AlertCircle } from "lucide-react";
export const metadata = {
title: '资源 - 特恩的日志',
description: '一些实用工具和学习资源',
};
export default async function Resources() {
let errorMsg = '';
const data = await ResourceAPI.list().catch(e => { errorMsg = `${e}`; return null; });
return (
<div className="flex-1 flex flex-col items-center">
<h1 className="mt-6 md:mt-20 text-2xl md:text-5xl font-medium text-zinc-800 dark:text-zinc-200 text-center duration-300"></h1>
<p className="mt-4 md:mt-8 mx-3 text-zinc-400 dark:text-zinc-300 text-sm text-center duration-300">
<a className="text-zinc-600 dark:text-zinc-400">使</a>
使</p>
{
errorMsg && (
<div className="mt-10 mx-5">
<Alert variant="destructive">
<AlertCircle className="h-4 w-4" />
<AlertTitle></AlertTitle>
<AlertDescription>
{errorMsg}
</AlertDescription>
</Alert>
</div>
)
}
<div className="mt-6 sm:mt-10 md:mt-15 w-full flex flex-col md:w-auto md:mx-auto md:grid grid-cols-2 2xl:gap-x-35 lg:gap-x-20 gap-x-10 lg:gap-y-10 gap-y-5 sm:mb-10 duration-300">
{data && data.map((resource) => (
<ResourceCard
key={resource.id}
r={resource}
/>
))}
</div>
</div>
)
}