/* ============================================================================
Card.Team - Figma 25:765 (280 x 295)
----------------------------------------------------------------------------
Portrait in an accent frame, name, role, affiliation and up to three social
links. The social links are real links, so the card itself is only stretched
over a link when `href` is given - and the links are lifted above the
overlay so they stay clickable.
USAGE
-----
// Optional bio page - the whole card becomes clickable, socials still work.
========================================================================= */
import { CardLink, CardMedia, CardShell, CardIcon, cx } from "./CardShell";
import type { CardElement, CardIconName, CardImage, CardTitleElement } from "./types";
export type CardTeamSocialKind = "linkedin" | "mail";
export interface CardTeamSocial {
kind: CardTeamSocialKind;
href: string;
/**
* Accessible name of the link. Defaults to the platform name; pass a
* translated string on Arabic pages ("البريد الإلكتروني").
*/
label?: string;
}
export interface CardTeamProps {
name: string;
role?: string;
/** Team, unit or initiative the person belongs to. */
affiliation?: string;
portrait?: CardImage;
socials?: CardTeamSocial[];
/** Optional bio page. Given, the whole card links to it. */
href?: string;
as?: CardElement;
titleAs?: CardTitleElement;
className?: string;
}
const SOCIAL_ICON: Record = {
linkedin: "linkedin",
mail: "mail",
};
const SOCIAL_LABEL: Record = {
linkedin: "LinkedIn",
mail: "Email",
};
export function CardTeam({
name,
role,
affiliation,
portrait,
socials,
href,
as = "article",
titleAs = "h3",
className,
}: CardTeamProps) {
const Title = titleAs;
return (
{/* 96px portrait inside the 4px accent frame, exactly as drawn. */}
{portrait ? (
) : null}
{href ? (
{name}
) : (
name
)}
{role ?
{role}
: null}
{affiliation ? (
{affiliation}
) : null}
{socials && socials.length > 0 ? (
/* sh-card-above keeps these clickable through the stretched-link
overlay when the card as a whole is a link. */
{socials.map((social) => (
-
{/* Figma strokes these icons in text/accent on a background/accent
chip - green on green, invisible. Painted with the always-white
on-accent role instead. */}
{`${social.label ?? SOCIAL_LABEL[social.kind]} - ${name}`}
))}
) : null}
);
}