diff --git a/src/app/components/ui/Badge.tsx b/src/app/components/ui/Badge.tsx new file mode 100644 index 0000000000..cacfbb1971 --- /dev/null +++ b/src/app/components/ui/Badge.tsx @@ -0,0 +1,35 @@ +import { type VariantProps, cva } from "class-variance-authority"; +import { cn } from "lib/cn"; +import { type ElementRef, type HTMLAttributes, forwardRef } from "react"; + +export const badgeVariants = cva( + "inline-flex items-center rounded-md px-2 transition-colors focus:outline-none focus-visible:ring-4 focus:ring-ring font-medium max-w-max gap-1.5 bg-badge-background text-badge-foreground", + { + variants: { + size: { + sm: "text-xs h-5", + md: "text-sm h-6", + lg: "text-base h-8", + }, + }, + defaultVariants: { + size: "md", + }, + }, +); + +export interface BadgeProps + extends HTMLAttributes, + VariantProps {} + +const Badge = forwardRef, BadgeProps>( + ({ className, size, ...props }, ref) => ( +
+ ), +); + +export { Badge }; diff --git a/src/app/components/ui/Card.tsx b/src/app/components/ui/Card.tsx new file mode 100644 index 0000000000..a9731698f6 --- /dev/null +++ b/src/app/components/ui/Card.tsx @@ -0,0 +1,18 @@ +import { cn } from "lib/cn"; +import { type HTMLAttributes, forwardRef } from "react"; + +const Card = forwardRef>( + ({ className, ...props }, ref) => ( +
+ ), +); +Card.displayName = "Card"; + +export { Card }; diff --git a/src/app/explorer/components/GuildCard.tsx b/src/app/explorer/components/GuildCard.tsx new file mode 100644 index 0000000000..e3116259fc --- /dev/null +++ b/src/app/explorer/components/GuildCard.tsx @@ -0,0 +1,32 @@ +import { ImageSquare, Users } from "@phosphor-icons/react/dist/ssr"; +import { Badge } from "app/components/ui/Badge"; +import { Card } from "app/components/ui/Card"; +import Link from "next/link"; + +export const GuildCard = () => { + return ( + + +
+ +
+ +

+ Sample guild +

+
+ + + + {new Intl.NumberFormat("en", { + notation: "compact", + }).format(125244)} + + + + 5 groups +
+
+ + ); +}; diff --git a/src/app/explorer/page.tsx b/src/app/explorer/page.tsx new file mode 100644 index 0000000000..83f7cd1db5 --- /dev/null +++ b/src/app/explorer/page.tsx @@ -0,0 +1,11 @@ +import { GuildCard } from "./components/GuildCard"; + +const Explorer = () => { + return ( +
+ +
+ ); +}; + +export default Explorer; diff --git a/src/app/globals.css b/src/app/globals.css index b1169dba1c..acacd8b029 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -99,6 +99,9 @@ html { --button-success-foreground: #fff; --button-success-subtle: var(--green-300); --button-success-subtle-foreground: var(--green-500); + + --badge-background: rgba(0, 0, 0, 0.06); + --badge-foreground: var(--foreground); } .dark { @@ -135,13 +138,15 @@ html { --button-success-foreground: #fff; --button-success-subtle: var(--green-300); --button-success-subtle-foreground: var(--green-500); + + --badge-background: rgba(255, 255, 255, 0.06); + --badge-foreground: var(--foreground); } .dark video, .dark img { @apply brightness-90 contrast-125; } - body { @apply bg-background text-foreground font-sans min-h-screen antialiased selection:bg-foreground selection:text-background; } diff --git a/src/stories/Badge.stories.tsx b/src/stories/Badge.stories.tsx new file mode 100644 index 0000000000..e567cfa9d0 --- /dev/null +++ b/src/stories/Badge.stories.tsx @@ -0,0 +1,25 @@ +import type { Meta, StoryObj } from "@storybook/react"; +import { Badge, type BadgeProps } from "app/components/ui/Badge"; + +const meta: Meta = { + title: "Design system/Badge", + component: Badge, +}; + +export default meta; + +type Story = StoryObj; + +export const Default: Story = { + args: { + children: "Default", + size: "md", + }, + argTypes: { + size: { + type: "string", + control: "select", + options: ["sm", "md", "lg"] satisfies BadgeProps["size"][], + }, + }, +}; diff --git a/tailwind.config.ts b/tailwind.config.ts index 8ed8044d91..e09050d8c2 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -23,6 +23,10 @@ const config = { card: "var(--card)", image: "var(--image)", skeleton: "var(--skeleton)", + badge: { + background: "var(--badge-background)", + foreground: "var(--badge-foreground)" + } }, }, },