From e4a80995f95663c58d01677df804831262f9b7e7 Mon Sep 17 00:00:00 2001 From: Dominik Stumpf Date: Thu, 21 Nov 2024 15:38:59 +0100 Subject: [PATCH] refactor: move out guild card --- src/app/explorer/components/GuildCard.tsx | 44 ------------- .../components/InfiniteScrollGuilds.tsx | 3 +- src/app/explorer/page.tsx | 4 +- src/components/GuildCard.tsx | 62 +++++++++++++++++++ src/components/GuildCardSkeleton.tsx | 18 ------ 5 files changed, 65 insertions(+), 66 deletions(-) create mode 100644 src/components/GuildCard.tsx delete mode 100644 src/components/GuildCardSkeleton.tsx diff --git a/src/app/explorer/components/GuildCard.tsx b/src/app/explorer/components/GuildCard.tsx index f43cf8e92f..e69de29bb2 100644 --- a/src/app/explorer/components/GuildCard.tsx +++ b/src/app/explorer/components/GuildCard.tsx @@ -1,44 +0,0 @@ -import { Badge } from "@/components/ui/Badge"; -import { Card } from "@/components/ui/Card"; -import { ImageSquare, Users } from "@phosphor-icons/react/dist/ssr"; -import { Avatar, AvatarFallback, AvatarImage } from "@radix-ui/react-avatar"; -import Link from "next/link"; -import type { FunctionComponent } from "react"; - -export const GuildCard: FunctionComponent<{ guild: Guild }> = ({ guild }) => { - return ( - - - - - - - - - -

- {guild.name} -

-
- - - - {new Intl.NumberFormat("en", { - notation: "compact", - }).format(12345)} - - - - 5 groups -
-
- - ); -}; diff --git a/src/app/explorer/components/InfiniteScrollGuilds.tsx b/src/app/explorer/components/InfiniteScrollGuilds.tsx index c59c48a33d..155422d8ba 100644 --- a/src/app/explorer/components/InfiniteScrollGuilds.tsx +++ b/src/app/explorer/components/InfiniteScrollGuilds.tsx @@ -1,6 +1,6 @@ "use client"; -import { GuildCardSkeleton } from "@/components/GuildCardSkeleton"; +import { GuildCard, GuildCardSkeleton } from "@/components/GuildCard"; import { Button } from "@/components/ui/Button"; import { useInfiniteQuery } from "@tanstack/react-query"; import { useIntersection } from "foxact/use-intersection"; @@ -9,7 +9,6 @@ import { useCallback, useEffect } from "react"; import { searchAtom } from "../atoms"; import { PAGE_SIZE } from "../constants"; import { getGuildSearch } from "../fetchers"; -import { GuildCard } from "./GuildCard"; export const InfiniteScrollGuilds = () => { const search = useAtomValue(searchAtom); diff --git a/src/app/explorer/page.tsx b/src/app/explorer/page.tsx index 33551590b0..046c5279b0 100644 --- a/src/app/explorer/page.tsx +++ b/src/app/explorer/page.tsx @@ -1,5 +1,6 @@ import { AuthBoundary } from "@/components/AuthBoundary"; -import { GuildCardSkeleton } from "@/components/GuildCardSkeleton"; +import { GuildCardSkeleton } from "@/components/GuildCard"; +import { GuildCard } from "@/components/GuildCard"; import { Button } from "@/components/ui/Button"; import { env } from "@/lib/env"; import { Plus, SignIn } from "@phosphor-icons/react/dist/ssr"; @@ -9,7 +10,6 @@ import { dehydrate, } from "@tanstack/react-query"; import { Suspense } from "react"; -import { GuildCard } from "./components/GuildCard"; import { InfiniteScrollGuilds } from "./components/InfiniteScrollGuilds"; import { Search } from "./components/Search"; import { getGuildSearch } from "./fetchers"; diff --git a/src/components/GuildCard.tsx b/src/components/GuildCard.tsx new file mode 100644 index 0000000000..be0f201d68 --- /dev/null +++ b/src/components/GuildCard.tsx @@ -0,0 +1,62 @@ +import { Badge } from "@/components/ui/Badge"; +import { Card } from "@/components/ui/Card"; +import { Skeleton } from "@/components/ui/Skeleton"; +import { ImageSquare, Users } from "@phosphor-icons/react/dist/ssr"; +import { Avatar, AvatarFallback, AvatarImage } from "@radix-ui/react-avatar"; +import Link from "next/link"; +import type { FunctionComponent } from "react"; + +export const GuildCard: FunctionComponent<{ guild: Guild }> = ({ guild }) => { + return ( + + + + + + + + + +

+ {guild.name} +

+
+ + + + {new Intl.NumberFormat("en", { + notation: "compact", + }).format(12345)} + + + + 5 groups +
+
+ + ); +}; + +export const GuildCardSkeleton = () => { + return ( +
+ + +
+ + +
+ + +
+
+
+ ); +}; diff --git a/src/components/GuildCardSkeleton.tsx b/src/components/GuildCardSkeleton.tsx deleted file mode 100644 index 90d429b7cf..0000000000 --- a/src/components/GuildCardSkeleton.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { Skeleton } from "@/components/ui/Skeleton"; - -export const GuildCardSkeleton = () => { - return ( -
- - -
- - -
- - -
-
-
- ); -};