/******************************************************************************** * Copyright (c) 2026 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * https://www.eclipse.org/legal/epl-2.0 * * SPDX-License-Identifier: EPL-2.0 ********************************************************************************/ import { FunctionComponent, ReactNode } from 'react'; import { Box, Typography, Chip } from '@mui/material'; import { Info as InfoIcon } from '@mui/icons-material'; import { useTheme } from '@mui/material/styles'; interface DetailField { label: string; value: string | undefined; } interface ScanDetailCardProps { accentColor: string; isUnenforced?: boolean; chip?: { label: string; color: string; textColor: string; }; description?: string; descriptionColor?: string; details: DetailField[]; children?: ReactNode; } /** * A detail card component for displaying scan detail items like errors, * threats, and validation failures. Provides styling with a colored * left border, optional chip badge, and metadata fields. */ export const ScanDetailCard: FunctionComponent = ({ accentColor, isUnenforced = false, chip, description, descriptionColor, details, children, }) => { const theme = useTheme(); return ( {/* Chip and unenforced indicator */} {(chip || isUnenforced) && ( {isUnenforced && ( Not enforced )} {chip && ( )} )} {/* Description */} {description && ( {description} )} {/* Detail fields */} {details.map((detail, index) => ( detail.value && ( {detail.label}: {detail.value} ) ))} {/* Additional content */} {children} ); };