Skip to content

Commit df16d92

Browse files
committed
feature: Add Card and SkillCard components with global style updates
Introduced a reusable Card component and its subcomponents (Header, Footer, Title, etc.) to structure UI elements consistently. Added a SkillCard component leveraging the Card for displaying skills with an icon, title, and description. Updated global styles to enhance border and background consistency.
1 parent e12266e commit df16d92

File tree

3 files changed

+118
-0
lines changed

3 files changed

+118
-0
lines changed

src/app/globals.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,14 @@ body {
7070
@apply bg-background text-foreground;
7171
}
7272
}
73+
74+
75+
76+
@layer base {
77+
* {
78+
@apply border-border outline-ring/50;
79+
}
80+
body {
81+
@apply bg-background text-foreground;
82+
}
83+
}

src/components/ui/card.tsx

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import * as React from "react"
2+
3+
import { cn } from "@/lib/utils"
4+
5+
const Card = React.forwardRef<
6+
HTMLDivElement,
7+
React.HTMLAttributes<HTMLDivElement>
8+
>(({ className, ...props }, ref) => (
9+
<div
10+
ref={ref}
11+
className={cn(
12+
"rounded-xl border bg-card text-card-foreground shadow",
13+
className
14+
)}
15+
{...props}
16+
/>
17+
))
18+
Card.displayName = "Card"
19+
20+
const CardHeader = React.forwardRef<
21+
HTMLDivElement,
22+
React.HTMLAttributes<HTMLDivElement>
23+
>(({ className, ...props }, ref) => (
24+
<div
25+
ref={ref}
26+
className={cn("flex flex-col space-y-1.5 p-6", className)}
27+
{...props}
28+
/>
29+
))
30+
CardHeader.displayName = "CardHeader"
31+
32+
const CardTitle = React.forwardRef<
33+
HTMLDivElement,
34+
React.HTMLAttributes<HTMLDivElement>
35+
>(({ className, ...props }, ref) => (
36+
<div
37+
ref={ref}
38+
className={cn("font-semibold leading-none tracking-tight", className)}
39+
{...props}
40+
/>
41+
))
42+
CardTitle.displayName = "CardTitle"
43+
44+
const CardDescription = React.forwardRef<
45+
HTMLDivElement,
46+
React.HTMLAttributes<HTMLDivElement>
47+
>(({ className, ...props }, ref) => (
48+
<div
49+
ref={ref}
50+
className={cn("text-sm text-muted-foreground", className)}
51+
{...props}
52+
/>
53+
))
54+
CardDescription.displayName = "CardDescription"
55+
56+
const CardContent = React.forwardRef<
57+
HTMLDivElement,
58+
React.HTMLAttributes<HTMLDivElement>
59+
>(({ className, ...props }, ref) => (
60+
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
61+
))
62+
CardContent.displayName = "CardContent"
63+
64+
const CardFooter = React.forwardRef<
65+
HTMLDivElement,
66+
React.HTMLAttributes<HTMLDivElement>
67+
>(({ className, ...props }, ref) => (
68+
<div
69+
ref={ref}
70+
className={cn("flex items-center p-6 pt-0", className)}
71+
{...props}
72+
/>
73+
))
74+
CardFooter.displayName = "CardFooter"
75+
76+
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { Card, CardContent } from "@/components/ui/card"
2+
import Image from "next/image"
3+
4+
interface SkillCardProps {
5+
title: string
6+
description: string
7+
iconUrl: string
8+
}
9+
10+
export default function SkillCard({ title, description, iconUrl }: SkillCardProps) {
11+
return (
12+
<Card className="w-full max-w-md overflow-hidden transition-shadow hover:shadow-lg">
13+
<CardContent className="p-6">
14+
<div className="flex items-start gap-2">
15+
<div className="relative h-8 w-8">
16+
<Image
17+
src={iconUrl || "/placeholder.svg"}
18+
alt={`${title} icon`}
19+
width={32}
20+
height={32}
21+
className="object-contain"
22+
/>
23+
</div>
24+
<span className="text-sm font-medium text-muted-foreground">{title}</span>
25+
</div>
26+
<p className="mt-4 text-sm text-muted-foreground">{description}</p>
27+
</CardContent>
28+
</Card>
29+
)
30+
}
31+

0 commit comments

Comments
 (0)