@@ -14,6 +14,7 @@ export interface ContentCardProps {
1414 buttonLabel ?: string ;
1515 author ?: string ;
1616 dateTime ?: string ;
17+ layout ?: "vertical" | "horizontal" ;
1718}
1819
1920export function ContentCard ( {
@@ -26,19 +27,39 @@ export function ContentCard({
2627 buttonLabel = "View more" ,
2728 author,
2829 dateTime,
30+ layout = "vertical" ,
2931} : ContentCardProps ) {
3032 const hasAuthor = Boolean ( author ) ;
3133 const hasDateTime = Boolean ( dateTime ) ;
34+ const isVerticalLayout = layout === "vertical" ;
35+ let layoutClass : string ;
36+
37+ if ( isVerticalLayout ) {
38+ if ( hasDateTime ) {
39+ layoutClass = "aspect-[10/13] max-w-[clamp(18rem,30vw,24rem)]" ;
40+ } else {
41+ layoutClass = "aspect-[10/11] max-w-[clamp(18rem,30vw,24rem)]" ;
42+ }
43+ } else {
44+ layoutClass = "flex-row aspect-[9/2] max-w-none" ;
45+ }
3246
3347 return (
3448 < article
3549 className = { cn (
36- "group flex aspect-[10/13] h-full w-full max-w-[clamp(18rem,30vw,24rem)] flex-col overflow-hidden rounded-[var(--radius)] border border-border/60 bg-[linear-gradient(0deg,rgba(255,255,255,0.05)_0%,rgba(255,255,255,0.05)_100%),linear-gradient(0deg,rgba(255,255,255,1)_0%,rgba(255,255,255,1)_100%)] text-card-foreground shadow-sm transition-all duration-300 hover:-translate-y-1 hover:shadow-lg" ,
37- hasDateTime ? "aspect-[10/13]" : "aspect-[10/11]" ,
50+ "group flex h-full w-full flex-col overflow-hidden rounded-[var(--radius)] border border-border/60 bg-[linear-gradient(0deg,rgba(255,255,255,0.05)_0%,rgba(255,255,255,0.05)_100%),linear-gradient(0deg,rgba(255,255,255,1)_0%,rgba(255,255,255,1)_100%)] text-card-foreground shadow-sm transition-all duration-300 hover:-translate-y-1 hover:shadow-lg" ,
51+ layoutClass ,
3852 className ,
3953 ) }
4054 >
41- < div className = "relative w-full flex-[0_0_55%] overflow-hidden bg-muted" >
55+ < div
56+ className = { cn (
57+ "relative overflow-hidden bg-muted" ,
58+ layout === "vertical"
59+ ? "w-full flex-[0_0_50%]"
60+ : "h-full w-[45%] shrink-0" ,
61+ ) }
62+ >
4263 < div className = "absolute inset-0" />
4364 { imageSrc ? (
4465 < Image
@@ -59,7 +80,7 @@ export function ContentCard({
5980 < div className = "absolute inset-0 bg-background/5" />
6081 </ div >
6182
62- < div className = "flex flex-1 flex-col gap-[clamp(0.5rem,1.2vw,0.75rem)] p -[clamp(0.5rem ,1.2vw,0.75rem )]" >
83+ < div className = "flex flex-1 flex-col gap-[clamp(0.5rem,1.2vw,0.75rem)] px -[clamp(0.8rem ,1.5vw,1.6rem)] py-[clamp(0.4rem,1.0vw,1.2rem )]" >
6384 { hasDateTime ? (
6485 < div className = "items-row flex items-center gap-2" >
6586 < Calendar size = { 16 } className = "text-muted-foreground" />
@@ -71,7 +92,14 @@ export function ContentCard({
7192
7293 < div className = "flex min-h-0 flex-1 flex-col justify-between overflow-hidden" >
7394 < div className = "max-h-[80%] space-y-2 overflow-hidden" >
74- < h3 className = "overflow-hidden text-[clamp(1rem,2.3vw,1.25rem)] font-semibold leading-[clamp(1.35,2.1vw,1.75)] tracking-tight text-foreground [-webkit-box-orient:vertical] [-webkit-line-clamp:2] [display:-webkit-box]" >
95+ < h3
96+ className = { cn (
97+ "overflow-hidden font-semibold leading-[clamp(1.35,2.1vw,1.75)] tracking-tight text-foreground [-webkit-box-orient:vertical] [-webkit-line-clamp:2] [display:-webkit-box]" ,
98+ isVerticalLayout
99+ ? "text-[clamp(1rem,2.3vw,1.25rem)]"
100+ : "text-[clamp(1.25rem,2.0vw,2.125rem)]" ,
101+ ) }
102+ >
75103 { title }
76104 </ h3 >
77105 < p className = "overflow-hidden text-[clamp(0.75rem,1.7vw,0.875rem)] leading-[clamp(1.25rem,2.2vw,1.5rem)] text-muted-foreground [-webkit-box-orient:vertical] [-webkit-line-clamp:3] [display:-webkit-box]" >
0 commit comments