aswi2023one-team-to-rule-them-all-gitlab/src/components/toast/SuccessToast.tsx @ f220395e
1 | c8be2597 | Fantič | |
---|---|---|---|
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 SuccessToastProps { |
||
7 | headerText?: string |
||
8 | text: string |
||
9 | onClose: () => void |
||
10 | }
|
||
11 | |||
12 | export const SuccessToast = (props: SuccessToastProps) => { |
||
13 | |||
14 | const { text, headerText, onClose } = props; |
||
15 | |||
16 | return ( |
||
17 | <Alert |
||
18 | alignSelf="center" |
||
19 | flexDirection="row" |
||
20 | variant="outline" |
||
21 | status="success" |
||
22 | backgroundColor={"success.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="success.700"> |
||
29 | {headerText} |
||
30 | </Text> : |
||
31 | <Text fontSize="xs" color="success.500"> |
||
32 | {text} |
||
33 | </Text>} |
||
34 | <Spacer /> |
||
35 | <IconButton |
||
36 | variant="unstyled" |
||
37 | icon={<CloseIcon size="3" color="success.500" />} |
||
38 | onPress={() => { |
||
39 | onClose(); |
||
40 | }} |
||
41 | />
|
||
42 | </HStack> |
||
43 | {headerText && |
||
44 | <Text fontSize="xs" color="success.500"> |
||
45 | {text} |
||
46 | </Text>} |
||
47 | </VStack> |
||
48 | </Alert> |
||
49 | )
|
||
50 | };
|