Projekt

Obecné

Profil

Stáhnout (1.61 KB) Statistiky
| Větev: | Tag: | Revize:
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
interface InfoToastProps {
6
    headerText?: string
7
    text: string
8
    onClose: () => void
9
}
10

    
11
export const InfoToast = (props: InfoToastProps) => {
12

    
13
    const { text, headerText, onClose } = props;
14

    
15
    return (
16
        <Alert
17
            alignSelf="center"
18
            flexDirection="row"
19
            variant="outline"
20
            status="info"
21
            backgroundColor={"info.50"}
22
        >
23
            <VStack>
24
                <HStack space={2} flexShrink={1} alignItems="center">
25
                    <Alert.Icon size="xs" />
26
                    {headerText ?
27
                        <Text fontSize="sm" fontWeight="medium" color="info.700">
28
                            {headerText}
29
                        </Text> :
30
                        <Text fontSize="xs" color="info.500">
31
                            {text}
32
                        </Text>}
33
                    <Spacer />
34
                    <IconButton
35
                        variant="unstyled"
36
                        icon={<CloseIcon size="3" color="info.500" />}
37
                        onPress={() => {
38
                            onClose();
39
                        }}
40
                    />
41
                </HStack>
42
                {headerText &&
43
                    <Text fontSize="xs" color="info.500">
44
                        {text}
45
                    </Text>}
46
            </VStack>
47
        </Alert>
48
    )
49
};
50

    
(2-2/3)