aswi2023one-team-to-rule-them-all-gitlab/src/components/toast/ErrorToast.tsx @ f220395e
1 | |
---|---|
2 |
import React from 'react'; |
3 |
import { HStack, CircleIcon, View, ScrollView, Button, Center, Heading, Pressable, Text, Box, Container, VStack, Icon, ArrowBackIcon, ChevronLeftIcon, ChevronRightIcon, useToast, Alert, IconButton, CloseIcon, Spacer } from "native-base"; |
4 | |
5 | |
6 |
interface ErrorToastProps { |
7 |
headerText?: string |
8 |
text: string |
9 |
onClose: () => void |
10 |
}
|
11 | |
12 |
export const ErrorToast = (props: ErrorToastProps) => { |
13 | |
14 |
const { text, headerText, onClose } = props; |
15 | |
16 |
return ( |
17 |
<Alert |
18 |
alignSelf="center" |
19 |
flexDirection="row" |
20 |
variant="outline" |
21 |
status="warning" |
22 |
backgroundColor={"error.50"} |
23 |
>
|
24 |
<VStack> |
25 |
<HStack space={2} flexShrink={1} alignItems="center"> |
26 |
<Alert.Icon size="xs" /> |
27 |
{headerText ? |
28 |
<Text fontSize="sm" fontWeight="medium" color="error.700"> |
29 |
{headerText} |
30 |
</Text> : |
31 |
<Text fontSize="xs" color="error.500"> |
32 |
{text} |
33 |
</Text>} |
34 |
<Spacer /> |
35 |
<IconButton |
36 |
variant="unstyled" |
37 |
icon={<CloseIcon size="3" color="error.500" />} |
38 |
onPress={() => { |
39 |
onClose(); |
40 |
}} |
41 |
/>
|
42 |
</HStack> |
43 |
{headerText && |
44 |
<Text fontSize="xs" color="error.500"> |
45 |
{text} |
46 |
</Text>} |
47 |
</VStack> |
48 |
</Alert> |
49 |
)
|
50 |
}
|
51 |