import { FC, createElement } from 'react'; import { Card, Box, Typography, Divider } from '@mui/material'; import { Link, To } from 'react-router-dom'; import type { ReactNode } from 'react'; import { LoadingIndicator } from 'react-admin'; import cartouche from './cartouche.png'; import cartoucheDark from './cartoucheDark.png'; interface Props { icon: FC; to: To; title?: string; subtitle?: string | number; children?: ReactNode; } const CardWithIcon = (props: Props) => { const { icon, title, subtitle, to, children } = props; return ( `url(${ theme.palette.mode === 'dark' ? cartoucheDark : cartouche }) no-repeat`, display: 'flex', justifyContent: 'space-between', alignItems: 'center', '& .icon': { color: (theme) => theme.palette.mode === 'dark' ? 'inherit' : '#dc2440', }, }} > {createElement(icon, { fontSize: 'large' })} {title} {subtitle ?? } {children && } {children} ); }; export default CardWithIcon;