Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | 1x 1x 3x 3x 3x 3x 3x 3x | import { Card } from "../Card";
import React, { CSSProperties } from "react";
export interface SpecialityCardInterface {
title: string;
title_icon: React.ReactNode;
image: string;
description: React.ReactNode;
variant: "darkblue" | "gradient1" | "gradient2";
align: "left" | "right";
fadeInIdx?: number;
}
// Map variants to colors / gradients
const variantMapping: Record<string, React.CSSProperties> = {
darkblue: { backgroundColor: "#111827" }, // bg-gray-900
gradient1: {
background: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
},
gradient2: {
background:
"linear-gradient(90deg, rgba(2,0,36,1) 0%, rgb(78,78,110) 35%, rgb(131,232,252) 100%)",
},
};
export const SpecialityCard: React.FC<SpecialityCardInterface> = (props) => {
// Container alignment style
const alignmentStyle: CSSProperties =
props.align === "left"
? { justifyContent: "flex-start" }
: { justifyContent: "flex-end", marginLeft: "auto" };
// Card style
const cardStyle: CSSProperties = {
width: "91.6667%", // w-11/12
boxShadow: "0 25px 50px rgba(0,0,0,0.25)", // shadow-2xl
border: "1px solid #E5E7EB",
borderRadius: 8, // rounded-lg
color: "white",
...variantMapping[props.variant],
...alignmentStyle,
};
// Title container style
const titleStyle: CSSProperties = {
display: "flex",
flexDirection: "row",
alignItems: "center",
gap: 16, // gap-4
fontSize: "1.875rem", // text-3xl
};
// Description container style
const descriptionStyle: CSSProperties = {
display: "flex",
flexDirection: "row",
gap: 32, // gap-8
alignItems: "center",
};
// Image style
const imageStyle: CSSProperties = {
width: "16.6667%", // w-2/12
borderRadius: 8, // rounded-lg
};
return (
<Card
title={
<div style={titleStyle}>
{props.title_icon}
<div>{props.title}</div>
</div>
}
description={
<div style={descriptionStyle}>
{props.align === "left" && <div>{props.description}</div>}
<img src={props.image} style={imageStyle} />
{props.align !== "left" && <div>{props.description}</div>}
</div>
}
fadeInIdx={props.fadeInIdx ?? 1}
style={cardStyle}
gradient={"false"} // gradients handled in cardStyle
/>
);
};
|