forked from microbit-foundation/python-editor-v3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultipleFilesDialog.tsx
More file actions
89 lines (84 loc) · 2.16 KB
/
Copy pathMultipleFilesDialog.tsx
File metadata and controls
89 lines (84 loc) · 2.16 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
/**
* (c) 2022, Micro:bit Educational Foundation and contributors
*
* SPDX-License-Identifier: MIT
*/
import { Text, VStack } from "@chakra-ui/react";
import { ReactNode } from "react";
import { FormattedMessage } from "react-intl";
import { GenericDialog, GenericDialogFooter } from "../common/GenericDialog";
import { useProject } from "../project/project-hooks";
export const enum MultipleFilesChoice {
CloseDontShowAgain,
Close,
}
interface MultipleFilesDialogProps {
callback: (value: MultipleFilesChoice) => void;
finalFocusRef: React.RefObject<HTMLButtonElement>;
}
export const MultipleFilesDialog = ({
callback,
finalFocusRef,
}: MultipleFilesDialogProps) => {
return (
<GenericDialog
finalFocusRef={finalFocusRef}
onClose={() => callback(MultipleFilesChoice.Close)}
body={<MultipleFilesDialogBody />}
footer={
<GenericDialogFooter
onClose={() => callback(MultipleFilesChoice.Close)}
onCloseDontShowAgain={() =>
callback(MultipleFilesChoice.CloseDontShowAgain)
}
dialogNormallyHidden={false}
/>
}
size="2xl"
/>
);
};
const MultipleFilesDialogBody = () => {
const project = useProject();
return (
<VStack
width="auto"
ml="auto"
mr="auto"
p={5}
pb={0}
spacing={5}
alignItems="flex-start"
>
<Text as="h2" fontSize="xl" fontWeight="semibold">
<FormattedMessage id="multiple-files-title" />
</Text>
<Text>
<FormattedMessage
id="multiple-files-message-one"
values={{
fileCount: project.files.length,
strong: (chunks: ReactNode) => (
<Text as="span" fontWeight="semibold">
{chunks}
</Text>
),
}}
/>
</Text>
<Text>
<FormattedMessage
id="multiple-files-message-two"
values={{
strong: (chunks: ReactNode) => (
<Text as="span" fontWeight="semibold">
{chunks}
</Text>
),
}}
/>
</Text>
</VStack>
);
};
export default MultipleFilesDialog;