Skip to content

Commit f668014

Browse files
committed
added product card! 💄
1 parent 77e6a98 commit f668014

File tree

7 files changed

+59
-4
lines changed

7 files changed

+59
-4
lines changed

app/(marketing)/page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {
2-
Accordion,
32
Avatar,
43
Badge,
54
BasicCard,

config/components.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ export const componentConfig = {
1414
name: "button",
1515
filePath: "packages/ui/Buttons/Button.tsx",
1616
},
17+
card: {
18+
name: "card",
19+
filePath: "packages/ui/Cards/Card.tsx",
20+
},
1721
},
1822
examples: {
1923
"accordion-style-default": {
@@ -82,6 +86,11 @@ export const componentConfig = {
8286
filePath: "preview/components/card-style-default.tsx",
8387
preview: lazy(() => import("@/preview/components/card-style-default")),
8488
},
89+
"card-style-commerce": {
90+
name: "card-style-commerce",
91+
filePath: "preview/components/card-style-commerce.tsx",
92+
preview: lazy(() => import("@/preview/components/card-style-commerce")),
93+
},
8594
"input-style-default": {
8695
name: "input-style-default",
8796
filePath: "preview/components/input-style-default.tsx",

content/docs/components/card.mdx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
11
---
22
title: Card
33
description: A customizable card component to visualize your content. 📝
4-
lastUpdated: 8 Oct, 2024
4+
lastUpdated: 20 Oct, 2024
55
---
66

7-
### Title with description
7+
<ComponentShowcase name="card-style-default" />
8+
<br />
9+
<br />
810

9-
<hr />
11+
## Installation
12+
13+
#### Copy the code 👇 into your project:
14+
15+
<ComponentSource name="card" />
1016
<br />
17+
<br />
18+
19+
## Examples
20+
21+
### Title with description
22+
1123
<ComponentShowcase name="card-style-default" />
24+
<br />
25+
<br />
26+
27+
### Product card
28+
29+
<ComponentShowcase name="card-style-commerce" />

packages/ui/Cards/Card.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { cn } from "@/lib/utils";
22
import { HTMLAttributes } from "react";
33
import { H3 } from "../Typography";
4+
import { Content } from "next/font/google";
45

56
interface ICardProps extends HTMLAttributes<HTMLDivElement> {
67
className?: string;
@@ -35,10 +36,15 @@ const CardDescription = ({ className, ...props }: ICardProps) => (
3536
<p className={cn("text-muted", className)} {...props} />
3637
);
3738

39+
const CardContent = ({ className, ...props }: ICardProps) => {
40+
return <div className={cn("p-4", className)} {...props} />;
41+
};
42+
3843
const CardComponent = Object.assign(Card, {
3944
Header: CardHeader,
4045
Title: CardTitle,
4146
Description: CardDescription,
47+
Content: CardContent,
4248
});
4349

4450
export { CardComponent as Card };
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Button, Card } from "@/packages/ui";
2+
3+
export default function CommerceCard() {
4+
return (
5+
<Card className="w-[350px] shadow-none hover:shadow-none">
6+
<Card.Content className="pb-0">
7+
<img
8+
src="/images/gameboy.jpg"
9+
className="w-full h-full"
10+
alt="Gameboy"
11+
/>
12+
</Card.Content>
13+
<Card.Header className="pb-0">
14+
<Card.Title>Classic 8-bit Gameboy</Card.Title>
15+
</Card.Header>
16+
<Card.Content className="flex justify-between items-center">
17+
<p className="text-lg font-semibold">$29.90</p>
18+
<Button>Add to cart</Button>
19+
</Card.Content>
20+
</Card>
21+
);
22+
}

public/images/gameboy.jpg

53.9 KB
Loading

tailwind.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const config: Config = {
55
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
66
"./packages/**/*.{js,ts,jsx,tsx,mdx}",
77
"./components/**/*.{js,ts,jsx,tsx,mdx}",
8+
"./preview/**/*.{js,ts,jsx,tsx,mdx}",
89
"./app/**/*.{js,ts,jsx,tsx,mdx}",
910
],
1011
theme: {

0 commit comments

Comments
 (0)