/
Info.tsx
47 lines (46 loc) · 1.38 KB
/
Info.tsx
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
import React from 'react';
import type { InfoAssetTransform } from '@player-ui/reference-assets-plugin';
import { ReactAsset } from '@player-ui/react';
import {
ButtonGroup,
Box,
Heading,
Divider,
Stack,
HStack,
} from '@chakra-ui/react';
/** The info view type is used to show information to the user */
export const Info = (props: InfoAssetTransform) => {
return (
<Box minW={{ base: undefined, md: 'md' }}>
<Stack gap="10">
{props.title && (
<Heading size="lg" as="h1">
<ReactAsset {...props.title} />
</Heading>
)}
{props.subTitle && (
<Heading size="md" as="h3">
<ReactAsset {...props.subTitle} />
</Heading>
)}
<Box>{props.primaryInfo && <ReactAsset {...props.primaryInfo} />}</Box>
<Stack gap="4">
{props?.segmentedActions && <Divider />}
<HStack justifyContent="space-between">
<ButtonGroup spacing="6">
{props?.segmentedActions?.prev?.map((a) => (
<ReactAsset key={a.asset.id} {...a} />
))}
</ButtonGroup>
<ButtonGroup spacing="6">
{props?.segmentedActions?.next?.map((a) => (
<ReactAsset key={a.asset.id} {...a} />
))}
</ButtonGroup>
</HStack>
</Stack>
</Stack>
</Box>
);
};