import React, { useEffect, useState } from "react"; import { getClientList, ClientData } from "../../index"; import { ClientCardProps } from "../../types"; /** * The ClientCardSM component * Renders a smaller profile card for a client and provides options for customization. * @param {string} client - The client ID to fetch client data. Required. * @param {string} [cardClassName] - CSS class for the card container. Optional. * @param {string} [bannerClassName] - CSS class for the banner. Optional. * @param {string} [avatarClassName] - CSS class for the avatar. Optional. * @param {React.CSSProperties} [style] - Inline styles for the card container. Optional. * @returns A React component that renders a compact client profile card with a banner. */ export const ClientCardSM: React.FC = ({ client, cardClassName, bannerClassName, avatarClassName, style, }) => { const [clientData, setClientData] = useState(null); /** * Fetches client card data from API */ useEffect(() => { getClientList().then((response) => { if ("data" in response) { const foundClient = response.data.find((c) => c.client === client); setClientData(foundClient || null); } }); }, [client]); if (!clientData) return
Loading...
; return (
{`${clientData.client}
); };