-
Notifications
You must be signed in to change notification settings - Fork 444
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: simple `Card` component * fix: update background color in light mode * chore: better playground page * revert foreground color change
- Loading branch information
1 parent
fc83d9c
commit d474773
Showing
3 changed files
with
48 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,33 @@ | ||
import { Card } from "@/components/ui/Card" | ||
import { Metadata } from "next" | ||
import { PropsWithChildren } from "react" | ||
import { ThemeToggle } from "../../v2/components/ThemeToggle" | ||
|
||
export const metadata: Metadata = { | ||
title: "Playground", | ||
} | ||
|
||
export default function Page() { | ||
return ( | ||
<div> | ||
<h1>Playground</h1> | ||
<ThemeToggle /> | ||
<div className="p-8"> | ||
<h1 className="text-2xl font-bold">Playground</h1> | ||
|
||
<div className="flex flex-col items-start gap-4"> | ||
<Section title="Theme toggle"> | ||
<ThemeToggle /> | ||
</Section> | ||
|
||
<Section title="Card"> | ||
<Card className="p-4">This is a card</Card> | ||
</Section> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
const Section = ({ title, children }: PropsWithChildren<{ title: string }>) => ( | ||
<section className="flex flex-col gap-2"> | ||
<h2 className="text-lg font-bold">{title}</h2> | ||
{children} | ||
</section> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import * as React from "react" | ||
|
||
import { cn } from "@/lib/utils" | ||
|
||
const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>( | ||
({ className, ...props }, ref) => ( | ||
<div | ||
ref={ref} | ||
className={cn( | ||
"overflow-hidden rounded-2xl bg-card text-card-foreground shadow-sm", | ||
className | ||
)} | ||
{...props} | ||
/> | ||
) | ||
) | ||
Card.displayName = "Card" | ||
|
||
export { Card } |