Skip to content

Commit db7eb25

Browse files
committed
feat: enhance card component styling with dynamic decoration size and padding adjustments
Signed-off-by: walnuts1018 <r.juglans.1018@gmail.com>
1 parent 88dbe4b commit db7eb25

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

src/components/Cards/Card.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@
3232
}
3333

3434
.content-card-title-row {
35+
--content-card-decoration-safe-inline: clamp(1.25rem, 7cqi, 2rem);
36+
3537
min-inline-size: 0;
38+
padding-inline-start: var(--content-card-decoration-safe-inline);
39+
}
40+
41+
.content-card[data-decoration-size="small"] .content-card-title-row {
42+
--content-card-decoration-safe-inline: clamp(0.5rem, 4cqi, 1rem);
3643
}
3744

3845
.content-card-title {
@@ -61,6 +68,14 @@
6168
}
6269

6370
@container content-card (width < 20rem) {
71+
.content-card-title-row {
72+
--content-card-decoration-safe-inline: 1.25rem;
73+
}
74+
75+
.content-card[data-decoration-size="small"] .content-card-title-row {
76+
--content-card-decoration-safe-inline: 0.5rem;
77+
}
78+
6479
.content-card-body {
6580
min-block-size: 11rem;
6681
}

src/components/Cards/Card.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ export function Card({
8686
const parsedDate = date ? format(date, "yyyy年MM月dd日") : "";
8787

8888
return (
89-
<div className="content-card card-grid-item font-Noto transition-all duration-200 hover:scale-105 active:scale-100">
89+
<div
90+
className="content-card card-grid-item font-Noto transition-all duration-200 hover:scale-105 active:scale-100"
91+
data-decoration-size={decorationSize}
92+
>
9093
<Link
9194
href={href}
9295
className="content-card-link card-shadow relative flex h-full cursor-pointer overflow-hidden rounded-2xl bg-[#f6f7fa] outline-hidden transition-all duration-200 focus:scale-105 active:bg-[#e2e2e2]"

0 commit comments

Comments
 (0)