'use client' import * as React from 'react' import { cn } from '../../utils/cn' import { tagVariants, type TagProps } from '../ui/tag' import { ActionsMenuDropdown, type ActionsMenuGroup } from '../ui/actions-menu' import { Ellipsis01Icon } from '../icons-v2-generated' import { getFirstLastInitials } from '../../utils/format' // ============================================================================= // Types // ============================================================================= /** A coloured status pill rendered to the right of the title/description. */ export interface MingoInfoCardStatus { /** Pill text — rendered uppercase via the `success`/`warning`/… Tag palette. */ label: React.ReactNode /** Tag colour. Defaults to `success` (green) to match the Figma sample. */ variant?: TagProps['variant'] } export interface MingoInfoCardProps { /** Card title — DM Sans Medium 18px (`text-h4`), white. Truncates on overflow. */ title: React.ReactNode /** Optional secondary line below the title — 14px (`text-h6`), grey. Truncates. */ description?: React.ReactNode /** * Leading 40px avatar image (`img="image"` variant in Figma). Takes * precedence over `icon` when both are supplied. Falls back to initials * derived from `imageAlt` if the image fails to load. */ imageSrc?: string /** Alt text / initials fallback for `imageSrc`. */ imageAlt?: string /** * Leading 24px glyph rendered inside a 40px box (`img="icon"` variant). * Ignored when `imageSrc` is set. Pass an `icons-v2-generated` icon — it * inherits `currentColor` from the box's `text-ods-text-primary`. */ icon?: React.ReactNode /** Optional status pill (e.g. `{ label: 'Online' }`). */ status?: MingoInfoCardStatus /** * Overflow-menu groups. When non-empty, a trailing "⋯" button opens an * `ActionsMenuDropdown`. Omit to hide the button entirely. */ menuGroups?: ReadonlyArray /** Aria-label for the "⋯" trigger. Defaults to `"More actions"`. */ menuAriaLabel?: string /** * Renders the main content region as an `` (for navigation) instead of a * ` ) : ( {content} )} {hasMenu && ( e.preventDefault()} customTrigger={ } /> )} ) }