Skip to content

Commit 77e6a98

Browse files
committed
updated core button component
1 parent 5081355 commit 77e6a98

File tree

4 files changed

+72
-6
lines changed

4 files changed

+72
-6
lines changed

app/(sink)/demo/components/page.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
TabsTrigger,
1212
TabsTriggerList,
1313
} from "@/packages/ui";
14+
import { Card } from "@/packages/ui/Cards/Card";
1415
import React from "react";
1516

1617
export default function page() {
@@ -67,6 +68,21 @@ export default function page() {
6768
</Accordion.Item>
6869
</Accordion>
6970
</div>
71+
72+
<div>
73+
<Card>
74+
<Card.Header>
75+
<Card.Title>Card Title</Card.Title>
76+
<Card.Description>Card Description</Card.Description>
77+
</Card.Header>
78+
</Card>
79+
<Accordion type="single" collapsible>
80+
<Accordion.Item value="item-1">
81+
<Accordion.Header>Head...</Accordion.Header>
82+
<Accordion.Content>Content...</Accordion.Content>
83+
</Accordion.Item>
84+
</Accordion>
85+
</div>
7086
</div>
7187
);
7288
}

packages/ui/Cards/Card.tsx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { cn } from "@/lib/utils";
2+
import { HTMLAttributes } from "react";
3+
import { H3 } from "../Typography";
4+
5+
interface ICardProps extends HTMLAttributes<HTMLDivElement> {
6+
className?: string;
7+
}
8+
9+
const Card = ({ className, ...props }: ICardProps) => {
10+
return (
11+
<div
12+
className={cn(
13+
"inline-block border-2 border-black shadow-md cursor-pointer transition-all hover:shadow-xs",
14+
className
15+
)}
16+
{...props}
17+
/>
18+
);
19+
};
20+
21+
const CardHeader = ({ className, ...props }: ICardProps) => {
22+
return (
23+
<div
24+
className={cn("flex flex-col justify-start p-4", className)}
25+
{...props}
26+
/>
27+
);
28+
};
29+
30+
const CardTitle = ({ className, ...props }: ICardProps) => {
31+
return <H3 className={cn("mb-2", className)} {...props} />;
32+
};
33+
34+
const CardDescription = ({ className, ...props }: ICardProps) => (
35+
<p className={cn("text-muted", className)} {...props} />
36+
);
37+
38+
const CardComponent = Object.assign(Card, {
39+
Header: CardHeader,
40+
Title: CardTitle,
41+
Description: CardDescription,
42+
});
43+
44+
export { CardComponent as Card };

packages/ui/Cards/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
export * from "./Card";
12
export * from "./BasicCard";
23
export * from "./ProductCard";
Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
import { Card } from "@/packages/ui";
2+
13
export default function BasicCard() {
24
return (
3-
<div className="inline-block border-2 border-black p-4 shadow-md cursor-pointer transition-all hover:shadow-xs">
4-
<h4 className="font-head text-2xl font-medium mb-1">
5-
This is card Title
6-
</h4>
7-
<p>This is card description.</p>
8-
</div>
5+
<Card>
6+
<Card.Header>
7+
<Card.Title>This is Card Title</Card.Title>
8+
<Card.Description>
9+
I can not find what to write here.. so imagine I wrote some good
10+
stuff.
11+
</Card.Description>
12+
</Card.Header>
13+
</Card>
914
);
1015
}

0 commit comments

Comments
 (0)