fix(SW-1188): add card variant
This commit is contained in:
@@ -111,6 +111,7 @@ export default function MegaMenu({
|
|||||||
onSecondaryButtonClick={handleNavigate}
|
onSecondaryButtonClick={handleNavigate}
|
||||||
imageGradient
|
imageGradient
|
||||||
theme="image"
|
theme="image"
|
||||||
|
height="dynamic"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
border-radius: var(--Corner-radius-Medium);
|
border-radius: var(--Corner-radius-Medium);
|
||||||
height: 320px; /* Fixed height from Figma */
|
|
||||||
margin-right: var(--Spacing-x2);
|
margin-right: var(--Spacing-x2);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -13,6 +12,14 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fixed {
|
||||||
|
height: 320px; /* Fixed height from Figma */
|
||||||
|
}
|
||||||
|
|
||||||
|
.dynamic {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.imageWrapper {
|
.imageWrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ export default function Card({
|
|||||||
imageGradient,
|
imageGradient,
|
||||||
onPrimaryButtonClick,
|
onPrimaryButtonClick,
|
||||||
onSecondaryButtonClick,
|
onSecondaryButtonClick,
|
||||||
|
height,
|
||||||
}: CardProps) {
|
}: CardProps) {
|
||||||
const buttonTheme = getButtonTheme(theme)
|
const buttonTheme = getButtonTheme(theme)
|
||||||
const titleFontColor = getTitleFontColor(theme)
|
const titleFontColor = getTitleFontColor(theme)
|
||||||
@@ -46,15 +47,21 @@ export default function Card({
|
|||||||
? backgroundImage.dimensions.aspectRatio * imageHeight
|
? backgroundImage.dimensions.aspectRatio * imageHeight
|
||||||
: 420)
|
: 420)
|
||||||
|
|
||||||
|
const imageWrapper =
|
||||||
|
height === "dynamic"
|
||||||
|
? `${styles.imageWrapper} ${styles.dynamic}`
|
||||||
|
: `${styles.imageWrapper} ${styles.fixed}`
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<article
|
<article
|
||||||
className={cardVariants({
|
className={cardVariants({
|
||||||
theme,
|
theme,
|
||||||
|
height,
|
||||||
className,
|
className,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{backgroundImage && (
|
{backgroundImage && (
|
||||||
<div className={imageGradient ? styles.imageWrapper : ""}>
|
<div className={imageGradient ? imageWrapper : ""}>
|
||||||
<Image
|
<Image
|
||||||
src={backgroundImage.url}
|
src={backgroundImage.url}
|
||||||
className={styles.image}
|
className={styles.image}
|
||||||
|
|||||||
@@ -16,8 +16,13 @@ export const cardVariants = cva(styles.container, {
|
|||||||
|
|
||||||
image: styles.themeImage,
|
image: styles.themeImage,
|
||||||
},
|
},
|
||||||
|
height: {
|
||||||
|
fixed: styles.fixed,
|
||||||
|
dynamic: styles.dynamic,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
defaultVariants: {
|
defaultVariants: {
|
||||||
theme: "one",
|
theme: "one",
|
||||||
|
height: "fixed",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user