import { cn } from "@/lib/utils"; import { LogSeverity } from "@/types/log"; import { ReactNode, useMemo } from "react"; import { isIOS } from "react-device-detect"; import { AnimatePresence, motion } from "framer-motion"; type ChipProps = { className?: string; children?: ReactNode | ReactNode[]; in?: boolean; onClick?: () => void; }; export default function Chip({ className, children, in: inProp = true, onClick, }: ChipProps) { return ( {inProp && ( { e.stopPropagation(); if (onClick) { onClick(); } }} > {children} )} ); } type LogChipProps = { severity: LogSeverity; onClickSeverity?: () => void; }; export function LogChip({ severity, onClickSeverity }: LogChipProps) { const severityClassName = useMemo(() => { switch (severity) { case "info": return "text-primary/60 bg-secondary hover:bg-secondary/60"; case "warning": return "text-warning-foreground bg-warning hover:bg-warning/80"; case "error": return "text-destructive-foreground bg-destructive hover:bg-destructive/80"; } }, [severity]); return (
{ e.stopPropagation(); if (onClickSeverity) { onClickSeverity(); } }} > {severity}
); }