-
Notifications
You must be signed in to change notification settings - Fork 490
Expand file tree
/
Copy pathLeftHelperText.tsx
More file actions
69 lines (63 loc) · 1.84 KB
/
Copy pathLeftHelperText.tsx
File metadata and controls
69 lines (63 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import { CheckIcon } from '@heroicons/react/outline';
import { Trans } from '@lingui/macro';
import { Box, Typography, useTheme } from '@mui/material';
import { ApprovalInfoContent } from '../../infoModalContents/ApprovalInfoContent';
import { RetryWithApprovalInfoContent } from '../../infoModalContents/RetryWithApprovalInfoContent';
import { TextWithModal } from '../../TextWithModal';
export type LeftHelperTextProps = {
error?: string;
approvalHash?: string;
amount?: string;
};
export const LeftHelperText = ({ error, approvalHash, amount }: LeftHelperTextProps) => {
const theme = useTheme();
return (
<Box
sx={{
display: 'flex',
justifyContent: 'flex-start',
alignItems: 'center',
}}
>
{approvalHash && (
<>
<CheckIcon
style={{
width: '12px',
height: '12px',
color: theme.palette.success.dark,
marginLeft: '2px',
}}
/>
<Typography variant="helperText" color="success.dark">
<Trans>Approve confirmed</Trans>
</Typography>
</>
)}
{error && (
<TextWithModal
text={<Trans>Retry What?</Trans>}
iconSize={13}
iconColor={theme.palette.text.secondary}
withContentButton
variant="helperText"
color="text.secondary"
>
<RetryWithApprovalInfoContent />
</TextWithModal>
)}
{!approvalHash && !error && amount && (
<TextWithModal
text={<Trans>Why do I need to approve?</Trans>}
iconSize={13}
iconColor={theme.palette.text.secondary}
withContentButton
variant="helperText"
color="text.secondary"
>
<ApprovalInfoContent />
</TextWithModal>
)}
</Box>
);
};