All files / components/text/Card/wrappers AssuranceCard.tsx

100% Statements 6/6
100% Branches 2/2
100% Functions 1/1
100% Lines 6/6

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                        1x                     1x   4x                           4x                 4x           4x                              
import { Card } from "../Card";
import React, { CSSProperties } from "react";
 
export interface AssuranceCardInterface {
  title: string;
  title_icon: React.ReactNode;
  description: React.ReactNode;
  variant: "darkblue" | "gradient1" | "gradient2";
  fadeInIdx?: number;
}
 
// Map variants to inline styles
const variantMapping: Record<string, 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 AssuranceCard: React.FC<AssuranceCardInterface> = (props) => {
  // Card container style
  const cardStyle: CSSProperties = {
    display: "flex",
    flexDirection: "column",
    alignItems: "center",
    textAlign: "center",
    boxShadow: "0 25px 50px rgba(0,0,0,0.25)", // shadow-2xl
    border: "1px solid #E5E7EB", // border-gray-200
    borderRadius: 8, // rounded-lg
    padding: 20,
    color: "white",
    ...variantMapping[props.variant],
  };
 
  // Title container style
  const titleStyle: CSSProperties = {
    display: "flex",
    flexDirection: "column",
    alignItems: "center",
    gap: 16, // gap-4
    fontSize: "1.875rem", // text-3xl
  };
 
  // Description style
  const descriptionStyle: CSSProperties = {
    fontSize: "1.125rem", // text-lg
    marginTop: 8,
    marginBottom: 8,
  };
 
  return (
    <Card
      title={
        <div style={titleStyle}>
          {props.title_icon}
          <div>{props.title}</div>
        </div>
      }
      description={<div style={descriptionStyle}>{props.description}</div>}
      fadeInIdx={props.fadeInIdx ?? 1}
      style={cardStyle}
      gradient={"false"} // handled inline
    />
  );
};