Skip to content

Commit d7316f0

Browse files
committed
Cards, Accordion ✅
1 parent 59e6a8f commit d7316f0

File tree

7 files changed

+85
-5
lines changed

7 files changed

+85
-5
lines changed

app/page.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import { Button, H1, H2, H3, H4, H5, H6, Input, Textarea } from "@/components";
2+
import { Button, H1, H2, H3, H4, H5, H6, Input, Textarea, Accordion, BasicCard, ProductCard } from "@/components";
33

44
export default function page() {
55
return (
@@ -30,10 +30,15 @@ export default function page() {
3030
</div>
3131

3232
<div>
33-
<H3>Forms</H3>
34-
<Input />
33+
<H3>Accordions</H3>
34+
<Accordion />
35+
</div>
36+
37+
<div>
38+
<H3>Cards</H3>
39+
<BasicCard />
3540
<div className="h-4"></div>
36-
<Textarea />
41+
<ProductCard />
3742
</div>
3843
</div>
3944
</div>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import React from "react";
2+
3+
export function Accordion() {
4+
return (
5+
<div className="space-y-4 mx-auto">
6+
<details className="border-2 border-black shadow-md hover:shadow-sm transition-all overflow-hidden">
7+
<summary className="px-4 py-2 font-head text-black cursor-pointer focus:outline-none">
8+
Accordion Item 1
9+
</summary>
10+
<div className="px-4 py-2 font-body bg-white text-gray-700">
11+
This is the content of the first accordion item. It is styled with
12+
Tailwind CSS.
13+
</div>
14+
</details>
15+
16+
<details className="border-2 border-black shadow-md hover:shadow-sm transition-all overflow-hidden">
17+
<summary className="px-4 py-2 font-head text-black cursor-pointer focus:outline-none">
18+
Accordion Item 2
19+
</summary>
20+
<div className="px-4 py-2 font-body bg-white text-gray-700">
21+
This is the content of the second accordion item. It has a similar
22+
style to maintain consistency.
23+
</div>
24+
</details>
25+
26+
<details className="border-2 border-black shadow-md hover:shadow-sm transition-all overflow-hidden">
27+
<summary className="px-4 py-2 font-head text-black cursor-pointer focus:outline-none">
28+
Accordion Item 3
29+
</summary>
30+
<div className="px-4 py-2 font-body bg-white text-gray-700">
31+
This is the content of the third accordion item. The details element
32+
handles the toggle behavior.
33+
</div>
34+
</details>
35+
</div>
36+
);
37+
}

components/Accordions/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./Accordion"

components/Cards/BasicCard.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from "react";
2+
3+
export function BasicCard() {
4+
return (
5+
<div className="inline-block border-2 border-black p-4 shadow-md cursor-pointer transition-all hover:shadow-xs">
6+
<h4 className="font-head text-2xl font-medium mb-1">
7+
This is card Title
8+
</h4>
9+
<p>This is card description.</p>
10+
</div>
11+
);
12+
}

components/Cards/ProductCard.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from "react";
2+
3+
export function ProductCard() {
4+
return (
5+
<div className="max-w-80 p-4 border-2 border-black">
6+
<img
7+
alt="product image"
8+
src="https://images.unsplash.com/photo-1596998791568-386ef5297c2e?q=80&w=2960&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"
9+
/>
10+
<div className="mt-4 space-y-4">
11+
<h3 className="font-head text-3xl font-medium mb-1">Classic Gameboy</h3>
12+
<div className="flex justify-between items-center">
13+
<span className="text-lg font-semibold">$29.99</span>
14+
<button className="px-6 py-2 text-sm font-head bg-primary-400 border-2 border-black shadow-md hover:shadow-xs transition-all">
15+
Add To Cart
16+
</button>
17+
</div>
18+
</div>
19+
</div>
20+
);
21+
}

components/Cards/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from "./BasicCard";
2+
export * from "./ProductCard";

components/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
export * from "./Buttons"
22
export * from "./Form"
3-
export * from "./Typography"
3+
export * from "./Typography"
4+
export * from "./Accordions"
5+
export * from "./Cards"

0 commit comments

Comments
 (0)