|
| 1 | +import { SyncAlt as SyncAltIcon } from '@mui/icons-material'; |
| 2 | +import { Grid, Tooltip, Typography } from '../../base'; |
| 3 | +import { useTheme } from '../../theme'; |
| 4 | +import { formatShortDate, formatShortDateTime } from './helper'; |
| 5 | +import { PopupButton, Record, TabCount, TabTitle } from './styles'; |
| 6 | + |
| 7 | +interface TransferButtonProps { |
| 8 | + title: string; |
| 9 | + count: number; |
| 10 | + onAssign: () => void; |
| 11 | + disabled: boolean; |
| 12 | +} |
| 13 | + |
| 14 | +interface RedirectButtonProps { |
| 15 | + title: string; |
| 16 | + count: number; |
| 17 | + disabled?: boolean; |
| 18 | +} |
| 19 | + |
| 20 | +export const TransferButton: React.FC<TransferButtonProps> = ({ |
| 21 | + title, |
| 22 | + count, |
| 23 | + onAssign, |
| 24 | + disabled |
| 25 | +}) => { |
| 26 | + const theme = useTheme(); |
| 27 | + return ( |
| 28 | + <PopupButton |
| 29 | + onClick={onAssign} |
| 30 | + disabled={disabled} |
| 31 | + color="primary" |
| 32 | + sx={{ |
| 33 | + color: theme.palette.background.neutral?.default, |
| 34 | + backgroundColor: theme.palette.background.constant?.table, |
| 35 | + margin: '0px 0px 10px', |
| 36 | + padding: '20px 10px', |
| 37 | + '&:hover': { |
| 38 | + backgroundColor: theme.palette.background.constant?.table, |
| 39 | + boxShadow: 'none' |
| 40 | + } |
| 41 | + }} |
| 42 | + > |
| 43 | + <Grid> |
| 44 | + <TabCount textColor={theme.palette.text.default}>{count}</TabCount> |
| 45 | + <TabTitle textColor={theme.palette.text.default}>{title}</TabTitle> |
| 46 | + <SyncAltIcon sx={{ position: 'absolute', top: '10px', right: '10px' }} /> |
| 47 | + </Grid> |
| 48 | + </PopupButton> |
| 49 | + ); |
| 50 | +}; |
| 51 | + |
| 52 | +export const RedirectButton: React.FC<RedirectButtonProps> = ({ |
| 53 | + title, |
| 54 | + count, |
| 55 | + disabled = true |
| 56 | +}) => { |
| 57 | + return ( |
| 58 | + <PopupButton disabled={disabled} color="primary" sx={{ boxShadow: 'none' }}> |
| 59 | + <Grid> |
| 60 | + <TabCount>{count}</TabCount> |
| 61 | + <TabTitle>{title}</TabTitle> |
| 62 | + {/* <ArrowForward /> */} |
| 63 | + </Grid> |
| 64 | + </PopupButton> |
| 65 | + ); |
| 66 | +}; |
| 67 | + |
| 68 | +interface RecordRowProps { |
| 69 | + title: string; |
| 70 | + name: string; |
| 71 | + date?: string | Date; |
| 72 | +} |
| 73 | + |
| 74 | +export const RecordRow: React.FC<RecordRowProps> = ({ title, name, date }) => { |
| 75 | + const theme = useTheme(); |
| 76 | + |
| 77 | + return ( |
| 78 | + <Record> |
| 79 | + <Grid xs={10} sx={{ display: 'flex', maxHeight: '140px' }}> |
| 80 | + <Typography |
| 81 | + sx={{ |
| 82 | + fontSize: 14, |
| 83 | + textAlign: 'left', |
| 84 | + color: theme.palette.background.constant?.white, |
| 85 | + maxWidth: 'max-content', |
| 86 | + overflowX: 'hidden' |
| 87 | + }} |
| 88 | + > |
| 89 | + {title} |
| 90 | + </Typography> |
| 91 | + <Typography |
| 92 | + sx={{ ml: 1, fontStyle: 'italic', color: theme.palette.background.brand?.default }} |
| 93 | + > |
| 94 | + {name} |
| 95 | + </Typography> |
| 96 | + </Grid> |
| 97 | + <Grid xs={2} sx={{ display: 'flex', justifyContent: 'flex-end' }}> |
| 98 | + <Tooltip title={date ? formatShortDateTime(date) : ''} placement="top"> |
| 99 | + <Typography |
| 100 | + sx={{ |
| 101 | + fontSize: 14, |
| 102 | + fontStyle: 'italic', |
| 103 | + color: `${theme.palette.text.disabled}`, |
| 104 | + paddingRight: '12px' |
| 105 | + }} |
| 106 | + > |
| 107 | + {date ? formatShortDate(date) : '-'} |
| 108 | + </Typography> |
| 109 | + </Tooltip> |
| 110 | + </Grid> |
| 111 | + </Record> |
| 112 | + ); |
| 113 | +}; |
0 commit comments