@@ -7,10 +7,26 @@ import type { CardIconProps } from "./types"
77import { getCardPaddingClasses , getContentGapClasses , getTitleSizeClasses } from "./utils"
88
99export function CardIcon ( props : CardIconProps ) {
10- const { title, icon, size = "md" , href, hoverEffect = false , className } = props
10+ const { title, icon, size = "md" , href, hoverEffect = false , align = "center" , className } = props
1111 const description = "description" in props ? props . description : undefined
1212 const Root = href ? "a" : "div"
1313 const isDescriptionCard = Boolean ( description )
14+ const isStartAligned = align === "start"
15+ const isCompactDescriptionCard = isDescriptionCard && size === "compact"
16+ const contentAlignmentClass = isDescriptionCard
17+ ? isStartAligned
18+ ? "items-start justify-start text-left"
19+ : "justify-between"
20+ : isStartAligned
21+ ? "items-start justify-center text-left"
22+ : "items-center justify-center text-center"
23+ const textAlignmentClass = isDescriptionCard
24+ ? isStartAligned
25+ ? "items-start gap-5 text-left"
26+ : "gap-2 text-left"
27+ : isStartAligned
28+ ? "items-start text-left"
29+ : "items-center text-center"
1430
1531 return (
1632 < Glass
@@ -29,31 +45,36 @@ export function CardIcon(props: CardIconProps) {
2945 { hoverEffect && < CardHoverBackground /> }
3046
3147 < div
32- className = { cn (
33- "relative z-10 flex h-full flex-1 flex-col" ,
34- getContentGapClasses ( size ) ,
35- isDescriptionCard ? "justify-between" : "items-center justify-center text-center"
36- ) }
48+ className = { cn ( "relative z-10 flex h-full flex-1 flex-col" , getContentGapClasses ( size ) , contentAlignmentClass ) }
3749 >
38- < div className = "flex justify-center" >
50+ < div className = { cn ( "flex" , isStartAligned ? " justify-start" : "justify- center") } >
3951 { isDescriptionCard ? (
4052 < DescriptionCardMedia icon = { icon } size = { size } />
4153 ) : (
4254 < BasicCardMedia icon = { icon } size = { size } />
4355 ) }
4456 </ div >
4557
46- < div className = { cn ( "flex flex-col" , isDescriptionCard ? "gap-2 text-left" : "items-center text-center" ) } >
58+ < div className = { cn ( "flex flex-col" , textAlignmentClass ) } >
4759 < h3
4860 className = { cn (
4961 getTitleSizeClasses ( size ) ,
5062 "bg-linear-to-b from-blue-secondary to-blue-primary bg-clip-text text-transparent" ,
51- isDescriptionCard ? "text-left" : "text-center"
63+ isDescriptionCard || isStartAligned ? "text-left" : "text-center"
5264 ) }
5365 >
5466 { title }
5567 </ h3 >
56- { description && < p className = "typo-body-medium max-w-sm text-left text-text-primary" > { description } </ p > }
68+ { description && (
69+ < p
70+ className = { cn (
71+ "text-left text-text-primary" ,
72+ isCompactDescriptionCard ? "typo-body-large max-w-60" : "typo-body-medium max-w-sm"
73+ ) }
74+ >
75+ { description }
76+ </ p >
77+ ) }
5778 </ div >
5879 </ div >
5980 </ Root >
0 commit comments