flockstr/app/(app)/app/_sections/LongFormContent.tsx

54 lines
1.4 KiB
TypeScript
Raw Normal View History

2023-10-15 22:15:49 -04:00
"use client";
2023-10-14 18:57:37 -04:00
import {
Section,
SectionHeader,
SectionTitle,
SectionContent,
} from "@/containers/PageSection";
import { Button } from "@/components/ui/button";
import { RiArrowRightLine } from "react-icons/ri";
import KindCard from "@/components/KindCard";
import { DUMMY_30023 } from "@/constants";
import Link from "next/link";
2023-10-15 22:15:49 -04:00
import useEvents from "@/lib/hooks/useEvents";
import { Event } from "nostr-tools";
2023-10-16 00:28:09 -04:00
import KindLoading from "@/components/KindCard/loading";
2023-10-14 18:57:37 -04:00
export default function LongFormContentSection() {
2023-10-15 22:15:49 -04:00
const { events } = useEvents({
filter: {
kinds: [30023],
limit: 10,
},
});
2023-10-14 18:57:37 -04:00
return (
<Section>
<SectionHeader>
<SectionTitle>Long form content</SectionTitle>
<Button variant={"ghost"}>
View all <RiArrowRightLine className="ml-1 h-4 w-4" />
</Button>
</SectionHeader>
<SectionContent className="sm:lg-feed-cols relative mx-auto flex flex-col gap-4">
2023-10-16 00:28:09 -04:00
{events?.length ? (
events.map((e) => {
const event = e.rawEvent() as Event;
return (
<Link key={e.id} href={`/article/${e.tagId}`}>
<KindCard {...event} />
</Link>
);
})
) : (
<>
<KindLoading />
<KindLoading />
<KindLoading />
<KindLoading />
</>
)}
2023-10-14 18:57:37 -04:00
</SectionContent>
</Section>
);
}