Projekt

Obecné

Profil

Stáhnout (1.75 KB) Statistiky
| Větev: | Tag: | Revize:
1 29f3811f Schwobik
import { Box, Center, HStack, Image, Pressable, ScrollView, Text, VStack } from "native-base"
2 e49b1f44 Schwobik
import { useEffect } from "react"
3 04928342 Schwobik
import { DrawerScreenProps } from "@react-navigation/drawer"
4 29f3811f Schwobik
import { RootDrawerParamList } from "../../pages/Navigation"
5
import { ItemPreviewMissingImage } from "./ItemPreviewMissingImage"
6 9c55d3bb Schwobik
7
interface ItemPreviewProps {
8
    caption: string
9
    title: string
10 ca53e9f1 Schwobik
    name?: string
11
    image?: string
12 04928342 Schwobik
    itemId: string
13 29f3811f Schwobik
    inventoryLabel: string
14 04928342 Schwobik
    navigation: any
15 9c55d3bb Schwobik
}
16
17
const ItemPreview = (props: ItemPreviewProps) => {
18
19
    return (
20
        <>
21 04928342 Schwobik
            <Pressable
22
                onPress={() => props.navigation.navigate("Item", {itemId: props.itemId})}
23
                key={props.itemId}
24 ca53e9f1 Schwobik
            >
25 04928342 Schwobik
                <HStack
26
                    space={ 2 }
27
                    flex={ 1 }
28 29f3811f Schwobik
                    alignItems={ "flex-start" }
29
                    key={props.itemId}
30 04928342 Schwobik
                >
31 29f3811f Schwobik
                    {props.image ? (
32 04928342 Schwobik
                    <Image
33 29f3811f Schwobik
                        source={ {uri: `http:/147.228.173.159/static/images/thumb-${props.image}`} }
34 04928342 Schwobik
                        size={ "sm" }
35 29f3811f Schwobik
                        alt={ props.image }
36 04928342 Schwobik
                    />
37 29f3811f Schwobik
                    ) : (
38
                        <ItemPreviewMissingImage inventoryLabel={props.inventoryLabel} h={65} w={65} />
39
                    )}
40
                    <VStack h={70} maxW={"80%"}>
41 04928342 Schwobik
                        <Text fontSize={"sm"} italic>{ props.name }</Text>
42 1980ed09 Schwobik
                        <Text fontSize={"sm"} bold noOfLines={1}>{ props.caption }</Text>
43 29f3811f Schwobik
                        <Text fontSize={"2xs"} lineHeight={"2xs"} noOfLines={2}>{ props.title }</Text>
44 04928342 Schwobik
                    </VStack>
45
                </HStack>
46
            </Pressable>
47 9c55d3bb Schwobik
        </>
48
    )
49
}
50
51
export default ItemPreview