on df0c310 help sign in
43 lines 942 B history raw
1import React from 'react';
2import { Box, Icon, Row } from '@tlon/indigo-react';
4import './Card.scss';
6export interface CardProps {
7 icon?: typeof Icon;
8 title?: string;
9 subtitle?: string;
10 warning?: string;
11 onClick?: () => void;
12 disabled?: boolean;
13 children?: React.ReactNode;
16export default function Card({
17 icon,
18 title,
19 subtitle,
20 warning,
21 onClick,
22 children,
23 disabled = false,
24}: CardProps) {
25 return (
26 <Box className="card" onClick={disabled ? undefined : onClick}>
27 {(!!icon || !!title) && (
28 <Row>
29 {!!icon && icon}
30 {!!title && <Box className="card-title">{title}</Box>}
31 </Row>
32 )}
33 {!!subtitle && <Box className="card-subtitle">{subtitle}</Box>}
34 {children}
35 {!!warning && (
36 <Row className="card-warning">
37 <Icon icon="ExclaimationMark" color="white" />
38 <Box>{warning}</Box>
39 </Row>
40 )}
41 </Box>
42 );