-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathWelcomeDialog.tsx
More file actions
93 lines (90 loc) · 2.8 KB
/
WelcomeDialog.tsx
File metadata and controls
93 lines (90 loc) · 2.8 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/**
* (c) 2021, Micro:bit Educational Foundation and contributors
*
* SPDX-License-Identifier: MIT
*/
import { Button } from "@chakra-ui/button";
import { HStack, Link, Stack, Text, VStack } from "@chakra-ui/layout";
import {
Modal,
ModalBody,
ModalContent,
ModalFooter,
ModalOverlay,
} from "@chakra-ui/modal";
import { Icon } from "@chakra-ui/react";
import { ReactNode } from "react";
import { RiExternalLinkLine } from "react-icons/ri";
import { FormattedMessage, useIntl } from "react-intl";
import ModalCloseButton from "../common/ModalCloseButton";
import YoutubeVideoEmbed from "../common/YoutubeVideoEmbed";
import { useDeployment } from "../deployment";
interface WelcomeDialogProps {
youtubeId: string;
isOpen: boolean;
onClose: () => void;
}
const WelcomeDialog = ({ youtubeId, isOpen, onClose }: WelcomeDialogProps) => {
const { guideLink } = useDeployment();
const intl = useIntl();
const welcomeVideoAltText = intl.formatMessage({ id: "welcome-video-alt" });
return (
<Modal isOpen={isOpen} onClose={onClose} size="2xl" scrollBehavior="outside">
<ModalOverlay>
<ModalContent>
<ModalCloseButton />
<ModalBody>
<VStack
width="auto"
ml="auto"
mr="auto"
p={5}
pb={0}
spacing={5}
alignItems="stretch"
>
<Stack spacing={3}>
<Text as="h2" fontSize="xl" fontWeight="semibold">
<FormattedMessage id="welcome-title" />
</Text>
<YoutubeVideoEmbed
youtubeId={youtubeId}
alt={welcomeVideoAltText}
/>
</Stack>
<Text>
<FormattedMessage id="welcome-message" />
</Text>
<Text>
<FormattedMessage
id="guide-link"
values={{
link: (chunks: ReactNode) => (
<Link
color="brand.500"
target="_blank"
rel="noreferrer"
href={guideLink}
>
{chunks}{" "}
<Icon as={RiExternalLinkLine} verticalAlign="middle" />
</Link>
),
}}
/>
</Text>
</VStack>
</ModalBody>
<ModalFooter>
<HStack spacing={2.5}>
<Button size="lg" variant="solid" onClick={onClose}>
<FormattedMessage id="start-coding-action" />
</Button>
</HStack>
</ModalFooter>
</ModalContent>
</ModalOverlay>
</Modal>
);
};
export default WelcomeDialog;