slice-machine-ui 2.9.2-beta.1 → 2.9.2-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/404.html +1 -1
- package/out/_next/static/chunks/150-772fe98f3591a687.js +1 -0
- package/out/_next/static/chunks/372-92310a383394bd51.js +1 -0
- package/out/_next/static/chunks/639-424b570eee9a37fb.js +1 -0
- package/out/_next/static/chunks/{764-b227a29a47c620de.js → 764-ddead927af7de6bb.js} +1 -1
- package/out/_next/static/chunks/{772-ed8f3990453f05fe.js → 772-936f6233f8a2b1f1.js} +1 -1
- package/out/_next/static/chunks/882-1fd1fbf0fe97a211.js +1 -0
- package/out/_next/static/chunks/pages/{_app-c83b3702096502bf.js → _app-a6ee26f3411a592f.js} +1 -1
- package/out/_next/static/chunks/pages/{changes-15ac7bd12a3861ec.js → changes-198b02e59f61136e.js} +1 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-d5df6446669f32d9.js +1 -0
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-06196e8bb64c8b8b.js +1 -0
- package/out/_next/static/chunks/pages/slices-2f1cb0b7c2288ad1.js +1 -0
- package/out/_next/static/{C_kG5UuAv3bmPpzp8Wkcn → hAN7AilU4wSYMuzNCdihY}/_buildManifest.js +1 -1
- package/out/changelog.html +1 -1
- package/out/changes.html +1 -1
- package/out/custom-types/[customTypeId].html +1 -1
- package/out/custom-types.html +1 -1
- package/out/index.html +1 -1
- package/out/labs.html +1 -1
- package/out/page-types/[pageTypeId].html +1 -1
- package/out/settings.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
- package/out/slices.html +1 -1
- package/package.json +3 -3
- package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewSliceDialog.tsx +1 -3
- package/src/legacy/components/AuthInstructions/index.jsx +22 -18
- package/src/legacy/components/Card/Default.jsx +25 -19
- package/src/legacy/components/Card/WithTabs/index.jsx +1 -1
- package/src/legacy/components/Card/index.tsx +43 -46
- package/src/legacy/components/ConfigErrors/index.jsx +23 -22
- package/src/legacy/components/DeleteCTModal/index.tsx +3 -3
- package/src/legacy/components/DeleteSliceModal/index.tsx +3 -3
- package/src/legacy/components/Forms/CreateSliceModal/CreateSliceModal.tsx +1 -1
- package/src/legacy/components/Forms/RenameSliceModal/RenameSliceModal.tsx +1 -1
- package/src/legacy/components/Forms/formsValidator.ts +0 -6
- package/src/legacy/components/ModalFormCard/index.tsx +29 -20
- package/src/legacy/components/ScreenshotChangesModal/index.tsx +28 -19
- package/src/legacy/components/ScreenshotPreviewModal/index.tsx +3 -3
- package/src/legacy/components/SliceMachineDrawer/index.tsx +3 -3
- package/src/legacy/components/Warnings/index.jsx +50 -45
- package/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/DeleteSliceZoneModal.tsx +3 -3
- package/src/legacy/lib/builders/common/EditModal/index.jsx +24 -17
- package/out/_next/static/chunks/150-d1a8b972d7fdbea4.js +0 -1
- package/out/_next/static/chunks/372-8a30b6213f74cec4.js +0 -1
- package/out/_next/static/chunks/639-175fa5cb82faf87c.js +0 -1
- package/out/_next/static/chunks/882-52e400abbe47296c.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]/simulator-dde04caa311e3119.js +0 -1
- package/out/_next/static/chunks/pages/slices/[lib]/[sliceName]/[variation]-5e6dbc213e2cb436.js +0 -1
- package/out/_next/static/chunks/pages/slices-acd530ebbca615c2.js +0 -1
- /package/out/_next/static/{C_kG5UuAv3bmPpzp8Wkcn → hAN7AilU4wSYMuzNCdihY}/_ssgManifest.js +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Flex, Heading, Text } from "theme-ui";
|
|
2
2
|
|
|
3
|
-
import Card from "../Card";
|
|
3
|
+
import { Card, useCardRadius } from "../Card";
|
|
4
4
|
|
|
5
5
|
const AuthInstructions = () => (
|
|
6
6
|
<Card
|
|
@@ -8,23 +8,7 @@ const AuthInstructions = () => (
|
|
|
8
8
|
bg="gray"
|
|
9
9
|
bodySx={{ p: 3 }}
|
|
10
10
|
sx={{ maxWidth: "480px", m: 3 }}
|
|
11
|
-
Header={
|
|
12
|
-
<Flex
|
|
13
|
-
sx={{
|
|
14
|
-
p: 3,
|
|
15
|
-
pl: 4,
|
|
16
|
-
bg: "headSection",
|
|
17
|
-
alignItems: "center",
|
|
18
|
-
justifyContent: "space-between",
|
|
19
|
-
borderTopLeftRadius: radius,
|
|
20
|
-
borderTopRightRadius: radius,
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
22
|
-
borderBottom: (t) => `1px solid ${t.colors?.borders}`,
|
|
23
|
-
}}
|
|
24
|
-
>
|
|
25
|
-
<Heading as="h3">Log in to Prismic</Heading>
|
|
26
|
-
</Flex>
|
|
27
|
-
)}
|
|
11
|
+
Header={<CardHeader />}
|
|
28
12
|
>
|
|
29
13
|
<Text as="p">
|
|
30
14
|
In order to access your builder, you will need to be connected to Prismic.
|
|
@@ -46,4 +30,24 @@ const AuthInstructions = () => (
|
|
|
46
30
|
</Card>
|
|
47
31
|
);
|
|
48
32
|
|
|
33
|
+
function CardHeader() {
|
|
34
|
+
const radius = useCardRadius();
|
|
35
|
+
return (
|
|
36
|
+
<Flex
|
|
37
|
+
sx={{
|
|
38
|
+
p: 3,
|
|
39
|
+
pl: 4,
|
|
40
|
+
bg: "headSection",
|
|
41
|
+
alignItems: "center",
|
|
42
|
+
justifyContent: "space-between",
|
|
43
|
+
borderTopLeftRadius: radius,
|
|
44
|
+
borderTopRightRadius: radius,
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
46
|
+
borderBottom: (t) => `1px solid ${t.colors?.borders}`,
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
<Heading as="h3">Log in to Prismic</Heading>
|
|
50
|
+
</Flex>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
49
53
|
export default AuthInstructions;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Box, Close, Flex } from "theme-ui";
|
|
2
2
|
|
|
3
|
-
import Card from "./";
|
|
3
|
+
import { Card, useCardRadius } from "./";
|
|
4
4
|
|
|
5
5
|
const DefaultCard = ({
|
|
6
6
|
children,
|
|
@@ -8,35 +8,21 @@ const DefaultCard = ({
|
|
|
8
8
|
HeaderContent,
|
|
9
9
|
close,
|
|
10
10
|
sx = {},
|
|
11
|
-
headerSx = {},
|
|
12
11
|
}) => (
|
|
13
12
|
<Card
|
|
14
13
|
borderFooter
|
|
15
14
|
footerSx={{ p: 0 }}
|
|
16
15
|
bodySx={{ pt: 2, pb: 4, px: 4 }}
|
|
17
16
|
sx={{ border: "none", ...sx }}
|
|
18
|
-
Header={
|
|
19
|
-
<
|
|
20
|
-
sx={{
|
|
21
|
-
p: 3,
|
|
22
|
-
pl: 4,
|
|
23
|
-
bg: "headSection",
|
|
24
|
-
alignItems: "center",
|
|
25
|
-
justifyContent: "space-between",
|
|
26
|
-
borderTopLeftRadius: radius,
|
|
27
|
-
borderTopRightRadius: radius,
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
29
|
-
borderBottom: (t) => `1px solid ${t.colors?.borders}`,
|
|
30
|
-
...headerSx,
|
|
31
|
-
}}
|
|
32
|
-
>
|
|
17
|
+
Header={
|
|
18
|
+
<CardHeader>
|
|
33
19
|
{HeaderContent}
|
|
34
20
|
{
|
|
35
21
|
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions, @typescript-eslint/no-unsafe-assignment
|
|
36
22
|
close ? <Close onClick={close} type="button" /> : null
|
|
37
23
|
}
|
|
38
|
-
</
|
|
39
|
-
|
|
24
|
+
</CardHeader>
|
|
25
|
+
}
|
|
40
26
|
Footer={
|
|
41
27
|
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
42
28
|
FooterContent ? (
|
|
@@ -51,4 +37,24 @@ const DefaultCard = ({
|
|
|
51
37
|
</Card>
|
|
52
38
|
);
|
|
53
39
|
|
|
40
|
+
function CardHeader({ children }) {
|
|
41
|
+
const radius = useCardRadius();
|
|
42
|
+
return (
|
|
43
|
+
<Flex
|
|
44
|
+
sx={{
|
|
45
|
+
p: 3,
|
|
46
|
+
pl: 4,
|
|
47
|
+
bg: "headSection",
|
|
48
|
+
alignItems: "center",
|
|
49
|
+
justifyContent: "space-between",
|
|
50
|
+
borderTopLeftRadius: radius,
|
|
51
|
+
borderTopRightRadius: radius,
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
53
|
+
borderBottom: (t) => `1px solid ${t.colors?.borders}`,
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
{children}
|
|
57
|
+
</Flex>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
54
60
|
export default DefaultCard;
|
|
@@ -2,7 +2,7 @@ import { Children, memo, useState } from "react";
|
|
|
2
2
|
import { TabPanel, Tabs } from "react-tabs";
|
|
3
3
|
import { Box } from "theme-ui";
|
|
4
4
|
|
|
5
|
-
import Card from "../";
|
|
5
|
+
import { Card } from "../";
|
|
6
6
|
import { CustomTab as Tab, CustomTabList as TabList } from "./components";
|
|
7
7
|
|
|
8
8
|
const WithTabs = ({
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { createContext, useContext } from "react";
|
|
2
2
|
import { Card as ThemeCard, ThemeUIStyleObject } from "theme-ui";
|
|
3
3
|
|
|
4
4
|
import { CardBox, CardBoxProps } from "./CardBox";
|
|
5
5
|
|
|
6
|
+
const CardRadiusContext = createContext<string>("6px");
|
|
7
|
+
|
|
8
|
+
export const useCardRadius = () => useContext(CardRadiusContext);
|
|
6
9
|
interface CardProps extends Omit<CardBoxProps, "withRadius"> {
|
|
7
|
-
Header?:
|
|
8
|
-
SubHeader?:
|
|
10
|
+
Header?: JSX.Element | null;
|
|
11
|
+
SubHeader?: JSX.Element | null;
|
|
9
12
|
Body?: React.FC | null;
|
|
10
13
|
Footer?: React.FC | JSX.Element | null;
|
|
11
14
|
borderFooter?: boolean;
|
|
@@ -13,7 +16,7 @@ interface CardProps extends Omit<CardBoxProps, "withRadius"> {
|
|
|
13
16
|
footerSx?: ThemeUIStyleObject;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
|
-
const Card: React.FC<CardProps> = ({
|
|
19
|
+
export const Card: React.FC<CardProps> = ({
|
|
17
20
|
Header = null,
|
|
18
21
|
SubHeader = null,
|
|
19
22
|
Body = null,
|
|
@@ -28,47 +31,41 @@ const Card: React.FC<CardProps> = ({
|
|
|
28
31
|
children,
|
|
29
32
|
...rest
|
|
30
33
|
}) => (
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
{SubHeader ? <SubHeader radius={radius} /> : null}
|
|
47
|
-
<CardBox bg={bg} background={background} sx={bodySx} withRadius={!Footer}>
|
|
48
|
-
{Body ? <Body /> : null}
|
|
49
|
-
{/* eslint-disable-next-line @typescript-eslint/strict-boolean-expressions */}
|
|
50
|
-
{children ? children : null}
|
|
51
|
-
</CardBox>
|
|
52
|
-
{Footer ? (
|
|
53
|
-
<CardBox
|
|
54
|
-
bg={bg}
|
|
55
|
-
background={background}
|
|
56
|
-
sx={{
|
|
57
|
-
...(borderFooter
|
|
58
|
-
? {
|
|
59
|
-
borderTop: ({ colors }) =>
|
|
60
|
-
`1px solid ${String(colors?.borders)}`,
|
|
61
|
-
}
|
|
62
|
-
: null),
|
|
63
|
-
...footerSx,
|
|
64
|
-
}}
|
|
65
|
-
radius={radius}
|
|
66
|
-
withRadius
|
|
67
|
-
>
|
|
68
|
-
{typeof Footer === "object" ? Footer : <Footer />}
|
|
34
|
+
<CardRadiusContext.Provider value={radius}>
|
|
35
|
+
<ThemeCard
|
|
36
|
+
sx={{
|
|
37
|
+
border: (t) => `1px solid ${String(t.colors?.borders)}`,
|
|
38
|
+
borderRadius: radius,
|
|
39
|
+
...sx,
|
|
40
|
+
}}
|
|
41
|
+
{...rest}
|
|
42
|
+
>
|
|
43
|
+
{Header ? Header : null}
|
|
44
|
+
{SubHeader ? SubHeader : null}
|
|
45
|
+
<CardBox bg={bg} background={background} sx={bodySx} withRadius={!Footer}>
|
|
46
|
+
{Body ? <Body /> : null}
|
|
47
|
+
{/* eslint-disable-next-line @typescript-eslint/strict-boolean-expressions */}
|
|
48
|
+
{children ? children : null}
|
|
69
49
|
</CardBox>
|
|
70
|
-
|
|
71
|
-
|
|
50
|
+
{Footer ? (
|
|
51
|
+
<CardBox
|
|
52
|
+
bg={bg}
|
|
53
|
+
background={background}
|
|
54
|
+
sx={{
|
|
55
|
+
...(borderFooter
|
|
56
|
+
? {
|
|
57
|
+
borderTop: ({ colors }) =>
|
|
58
|
+
`1px solid ${String(colors?.borders)}`,
|
|
59
|
+
}
|
|
60
|
+
: null),
|
|
61
|
+
...footerSx,
|
|
62
|
+
}}
|
|
63
|
+
radius={radius}
|
|
64
|
+
withRadius
|
|
65
|
+
>
|
|
66
|
+
{typeof Footer === "object" ? Footer : <Footer />}
|
|
67
|
+
</CardBox>
|
|
68
|
+
) : null}
|
|
69
|
+
</ThemeCard>
|
|
70
|
+
</CardRadiusContext.Provider>
|
|
72
71
|
);
|
|
73
|
-
|
|
74
|
-
export default Card;
|
|
@@ -1,30 +1,10 @@
|
|
|
1
1
|
import { Box, Flex, Heading, Text } from "theme-ui";
|
|
2
2
|
|
|
3
|
-
import Card from "@/legacy/components/Card";
|
|
3
|
+
import { Card, useCardRadius } from "@/legacy/components/Card";
|
|
4
4
|
import Li from "@/legacy/components/Li";
|
|
5
5
|
|
|
6
6
|
const ConfigErrors = ({ errors }) => (
|
|
7
|
-
<Card
|
|
8
|
-
bg="background"
|
|
9
|
-
bodySx={{ p: 3 }}
|
|
10
|
-
Header={({ radius }) => (
|
|
11
|
-
<Flex
|
|
12
|
-
sx={{
|
|
13
|
-
p: 3,
|
|
14
|
-
alignItems: "center",
|
|
15
|
-
justifyContent: "space-between",
|
|
16
|
-
borderTopLeftRadius: radius,
|
|
17
|
-
borderTopRightRadius: radius,
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
19
|
-
borderBottom: (t) => `1px solid ${t.colors?.borders}`,
|
|
20
|
-
}}
|
|
21
|
-
>
|
|
22
|
-
<Heading as="h3">
|
|
23
|
-
Your slicemachine.config.json file contains errors
|
|
24
|
-
</Heading>
|
|
25
|
-
</Flex>
|
|
26
|
-
)}
|
|
27
|
-
>
|
|
7
|
+
<Card bg="background" bodySx={{ p: 3 }} Header={<CardHeader />}>
|
|
28
8
|
{
|
|
29
9
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
30
10
|
Object.entries(errors).map(([key, value]) => (
|
|
@@ -65,4 +45,25 @@ const ConfigErrors = ({ errors }) => (
|
|
|
65
45
|
</Card>
|
|
66
46
|
);
|
|
67
47
|
|
|
48
|
+
function CardHeader() {
|
|
49
|
+
const radius = useCardRadius();
|
|
50
|
+
return (
|
|
51
|
+
<Flex
|
|
52
|
+
sx={{
|
|
53
|
+
p: 3,
|
|
54
|
+
alignItems: "center",
|
|
55
|
+
justifyContent: "space-between",
|
|
56
|
+
borderTopLeftRadius: radius,
|
|
57
|
+
borderTopRightRadius: radius,
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
59
|
+
borderBottom: (t) => `1px solid ${t.colors?.borders}`,
|
|
60
|
+
}}
|
|
61
|
+
>
|
|
62
|
+
<Heading as="h3">
|
|
63
|
+
Your slicemachine.config.json file contains errors
|
|
64
|
+
</Heading>
|
|
65
|
+
</Flex>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
68
69
|
export default ConfigErrors;
|
|
@@ -7,7 +7,7 @@ import { Close, Flex, Heading, Text, useThemeUI } from "theme-ui";
|
|
|
7
7
|
import { deleteCustomType } from "@/features/customTypes/actions/deleteCustomType";
|
|
8
8
|
import { CUSTOM_TYPES_MESSAGES } from "@/features/customTypes/customTypesMessages";
|
|
9
9
|
import { Button } from "@/legacy/components/Button";
|
|
10
|
-
import Card from "@/legacy/components/Card";
|
|
10
|
+
import { Card } from "@/legacy/components/Card";
|
|
11
11
|
import SliceMachineModal from "@/legacy/components/SliceMachineModal";
|
|
12
12
|
import useSliceMachineActions from "@/modules/useSliceMachineActions";
|
|
13
13
|
|
|
@@ -64,7 +64,7 @@ export const DeleteCustomTypeModal: React.FunctionComponent<
|
|
|
64
64
|
}}
|
|
65
65
|
sx={{ border: "none", overflow: "hidden" }}
|
|
66
66
|
borderFooter
|
|
67
|
-
Header={
|
|
67
|
+
Header={
|
|
68
68
|
<Flex
|
|
69
69
|
sx={{
|
|
70
70
|
position: "sticky",
|
|
@@ -88,7 +88,7 @@ export const DeleteCustomTypeModal: React.FunctionComponent<
|
|
|
88
88
|
</Flex>
|
|
89
89
|
<Close type="button" onClick={() => onClose()} />
|
|
90
90
|
</Flex>
|
|
91
|
-
|
|
91
|
+
}
|
|
92
92
|
Footer={() => (
|
|
93
93
|
<Flex
|
|
94
94
|
sx={{
|
|
@@ -5,7 +5,7 @@ import { Close, Flex, Heading, Paragraph, Text, useThemeUI } from "theme-ui";
|
|
|
5
5
|
import { deleteSlice } from "@/features/slices/actions/deleteSlice";
|
|
6
6
|
import { useAutoSync } from "@/features/sync/AutoSyncProvider";
|
|
7
7
|
import { Button } from "@/legacy/components/Button";
|
|
8
|
-
import Card from "@/legacy/components/Card";
|
|
8
|
+
import { Card } from "@/legacy/components/Card";
|
|
9
9
|
import SliceMachineModal from "@/legacy/components/SliceMachineModal";
|
|
10
10
|
import useSliceMachineActions from "@/modules/useSliceMachineActions";
|
|
11
11
|
|
|
@@ -68,7 +68,7 @@ export const DeleteSliceModal: React.FunctionComponent<
|
|
|
68
68
|
}}
|
|
69
69
|
sx={{ border: "none" }}
|
|
70
70
|
borderFooter
|
|
71
|
-
Header={
|
|
71
|
+
Header={
|
|
72
72
|
<Flex
|
|
73
73
|
sx={{
|
|
74
74
|
position: "sticky",
|
|
@@ -92,7 +92,7 @@ export const DeleteSliceModal: React.FunctionComponent<
|
|
|
92
92
|
</Flex>
|
|
93
93
|
<Close type="button" onClick={onClose} />
|
|
94
94
|
</Flex>
|
|
95
|
-
|
|
95
|
+
}
|
|
96
96
|
Footer={() => (
|
|
97
97
|
<Flex
|
|
98
98
|
sx={{
|
|
@@ -70,7 +70,7 @@ export const CreateSliceModal: FC<CreateSliceModalProps> = ({
|
|
|
70
70
|
from: localLibraries[0].name,
|
|
71
71
|
}}
|
|
72
72
|
validate={(values) =>
|
|
73
|
-
validateSliceModalValues(values, localLibraries, remoteSlices
|
|
73
|
+
validateSliceModalValues(values, localLibraries, remoteSlices)
|
|
74
74
|
}
|
|
75
75
|
content={{
|
|
76
76
|
title: "Create a new slice",
|
|
@@ -65,7 +65,7 @@ export const RenameSliceModal: React.FC<RenameSliceModalProps> = ({
|
|
|
65
65
|
title: "Rename a slice",
|
|
66
66
|
}}
|
|
67
67
|
validate={(values) =>
|
|
68
|
-
validateSliceModalValues(values, localLibs, remoteLibs
|
|
68
|
+
validateSliceModalValues(values, localLibs, remoteLibs)
|
|
69
69
|
}
|
|
70
70
|
>
|
|
71
71
|
{({ touched, errors }) => (
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import camelCase from "lodash/camelCase";
|
|
2
2
|
import startCase from "lodash/startCase";
|
|
3
3
|
|
|
4
|
-
import { telemetry } from "@/apiClient";
|
|
5
4
|
import { API_ID_REGEX, RESERVED_SLICE_NAME } from "@/legacy/lib/consts";
|
|
6
5
|
import { LibraryUI } from "@/legacy/lib/models/common/LibraryUI";
|
|
7
6
|
import { SliceSM } from "@/legacy/lib/models/common/Slice";
|
|
@@ -18,7 +17,6 @@ export function validateSliceModalValues(
|
|
|
18
17
|
{ sliceName }: SliceModalValues,
|
|
19
18
|
localLibs: ReadonlyArray<LibraryUI>,
|
|
20
19
|
remoteLibs: ReadonlyArray<SliceSM>,
|
|
21
|
-
event: "create" | "update",
|
|
22
20
|
): SliceModalValuesValidity {
|
|
23
21
|
if (!sliceName) {
|
|
24
22
|
return { sliceName: "Cannot be empty" };
|
|
@@ -28,10 +26,6 @@ export function validateSliceModalValues(
|
|
|
28
26
|
}
|
|
29
27
|
const cased = startCase(camelCase(sliceName)).replace(/\s/gm, "");
|
|
30
28
|
if (cased !== sliceName.trim()) {
|
|
31
|
-
void telemetry.track({
|
|
32
|
-
event: `slice-name-error:pascal-case`,
|
|
33
|
-
errorType: event,
|
|
34
|
-
});
|
|
35
29
|
return { sliceName: "Value has to be PascalCased" };
|
|
36
30
|
}
|
|
37
31
|
// See: #599
|
|
@@ -17,7 +17,7 @@ import { Button as ThemeButton, Close, Flex, Heading } from "theme-ui";
|
|
|
17
17
|
import { Button } from "@/legacy/components/Button";
|
|
18
18
|
import SliceMachineModal from "@/legacy/components/SliceMachineModal";
|
|
19
19
|
|
|
20
|
-
import Card from "../Card";
|
|
20
|
+
import { Card, useCardRadius } from "../Card";
|
|
21
21
|
|
|
22
22
|
type ModalCardProps<T extends FormikValues> = {
|
|
23
23
|
children: (props: {
|
|
@@ -120,27 +120,12 @@ function ModalCard<Values extends FormikValues>({
|
|
|
120
120
|
bodySx={{ px: 4, py: 4 }}
|
|
121
121
|
sx={{ border: "none" }}
|
|
122
122
|
{...cardProps}
|
|
123
|
-
Header={
|
|
124
|
-
<
|
|
125
|
-
sx={{
|
|
126
|
-
position: "sticky",
|
|
127
|
-
top: 0,
|
|
128
|
-
zIndex: 1,
|
|
129
|
-
p: "16px",
|
|
130
|
-
pl: 4,
|
|
131
|
-
bg: "headSection",
|
|
132
|
-
alignItems: "center",
|
|
133
|
-
justifyContent: "space-between",
|
|
134
|
-
borderTopLeftRadius: radius,
|
|
135
|
-
borderTopRightRadius: radius,
|
|
136
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
137
|
-
borderBottom: (t) => `1px solid ${t.colors?.borders}`,
|
|
138
|
-
}}
|
|
139
|
-
>
|
|
123
|
+
Header={
|
|
124
|
+
<CardHeader>
|
|
140
125
|
<Heading sx={{ fontSize: "20px" }}>{title}</Heading>
|
|
141
126
|
<Close type="button" onClick={close} />
|
|
142
|
-
</
|
|
143
|
-
|
|
127
|
+
</CardHeader>
|
|
128
|
+
}
|
|
144
129
|
Footer={
|
|
145
130
|
!omitFooter ? (
|
|
146
131
|
<Flex
|
|
@@ -200,4 +185,28 @@ function ModalCard<Values extends FormikValues>({
|
|
|
200
185
|
);
|
|
201
186
|
}
|
|
202
187
|
|
|
188
|
+
function CardHeader({ children }: { children: ReactNode }) {
|
|
189
|
+
const radius = useCardRadius();
|
|
190
|
+
return (
|
|
191
|
+
<Flex
|
|
192
|
+
sx={{
|
|
193
|
+
position: "sticky",
|
|
194
|
+
top: 0,
|
|
195
|
+
zIndex: 1,
|
|
196
|
+
p: "16px",
|
|
197
|
+
pl: 4,
|
|
198
|
+
bg: "headSection",
|
|
199
|
+
alignItems: "center",
|
|
200
|
+
justifyContent: "space-between",
|
|
201
|
+
borderTopLeftRadius: radius,
|
|
202
|
+
borderTopRightRadius: radius,
|
|
203
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
204
|
+
borderBottom: (t) => `1px solid ${t.colors?.borders}`,
|
|
205
|
+
}}
|
|
206
|
+
>
|
|
207
|
+
{children}
|
|
208
|
+
</Flex>
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
|
|
203
212
|
export default ModalCard;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
1
|
+
import { ReactNode, useEffect, useState } from "react";
|
|
2
2
|
import { AiOutlinePicture } from "react-icons/ai";
|
|
3
3
|
import { RiErrorWarningLine } from "react-icons/ri";
|
|
4
4
|
import { useSelector } from "react-redux";
|
|
@@ -6,7 +6,7 @@ import { Box, Close, Flex, Heading, Text } from "theme-ui";
|
|
|
6
6
|
|
|
7
7
|
import { Kbd } from "@/components/Kbd";
|
|
8
8
|
import { FigmaIcon } from "@/icons/FigmaIcon";
|
|
9
|
-
import Card from "@/legacy/components/Card";
|
|
9
|
+
import { Card, useCardRadius } from "@/legacy/components/Card";
|
|
10
10
|
import SliceMachineModal from "@/legacy/components/SliceMachineModal";
|
|
11
11
|
import { ComponentUI } from "@/legacy/lib/models/common/ComponentUI";
|
|
12
12
|
import { isModalOpen } from "@/modules/modal";
|
|
@@ -207,25 +207,12 @@ const ScreenshotChangesModal = ({
|
|
|
207
207
|
radius={"0px"}
|
|
208
208
|
bodySx={{ p: 0, bg: "#FFF", position: "relative" }}
|
|
209
209
|
sx={{ border: "none" }}
|
|
210
|
-
Header={
|
|
211
|
-
<
|
|
212
|
-
sx={{
|
|
213
|
-
position: "sticky",
|
|
214
|
-
top: 0,
|
|
215
|
-
zIndex: 1,
|
|
216
|
-
background: "gray",
|
|
217
|
-
p: "16px",
|
|
218
|
-
alignItems: "center",
|
|
219
|
-
justifyContent: "space-between",
|
|
220
|
-
borderTopLeftRadius: radius,
|
|
221
|
-
borderTopRightRadius: radius,
|
|
222
|
-
borderBottom: (t) => `1px solid ${String(t.colors?.borders)}`,
|
|
223
|
-
}}
|
|
224
|
-
>
|
|
210
|
+
Header={
|
|
211
|
+
<CardHeader>
|
|
225
212
|
<Heading sx={{ fontSize: "20px" }}>Slice screenshots</Heading>
|
|
226
213
|
<Close type="button" onClick={() => closeModals()} />
|
|
227
|
-
</
|
|
228
|
-
|
|
214
|
+
</CardHeader>
|
|
215
|
+
}
|
|
229
216
|
Footer={null}
|
|
230
217
|
>
|
|
231
218
|
<Box
|
|
@@ -285,4 +272,26 @@ const ScreenshotChangesModal = ({
|
|
|
285
272
|
);
|
|
286
273
|
};
|
|
287
274
|
|
|
275
|
+
function CardHeader({ children }: { children: ReactNode }) {
|
|
276
|
+
const radius = useCardRadius();
|
|
277
|
+
return (
|
|
278
|
+
<Flex
|
|
279
|
+
sx={{
|
|
280
|
+
position: "sticky",
|
|
281
|
+
top: 0,
|
|
282
|
+
zIndex: 1,
|
|
283
|
+
background: "gray",
|
|
284
|
+
p: "16px",
|
|
285
|
+
alignItems: "center",
|
|
286
|
+
justifyContent: "space-between",
|
|
287
|
+
borderTopLeftRadius: radius,
|
|
288
|
+
borderTopRightRadius: radius,
|
|
289
|
+
borderBottom: (t) => `1px solid ${String(t.colors?.borders)}`,
|
|
290
|
+
}}
|
|
291
|
+
>
|
|
292
|
+
{children}
|
|
293
|
+
</Flex>
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
|
|
288
297
|
export default ScreenshotChangesModal;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useSelector } from "react-redux";
|
|
2
2
|
import { Button, Close, Flex, Heading } from "theme-ui";
|
|
3
3
|
|
|
4
|
-
import Card from "@/legacy/components/Card";
|
|
4
|
+
import { Card } from "@/legacy/components/Card";
|
|
5
5
|
import { ScreenshotPreview } from "@/legacy/components/ScreenshotPreview";
|
|
6
6
|
import SliceMachineModal from "@/legacy/components/SliceMachineModal";
|
|
7
7
|
import { isModalOpen } from "@/modules/modal";
|
|
@@ -53,7 +53,7 @@ const ScreenshotPreviewModal: React.FunctionComponent<ScreenshotModalProps> = ({
|
|
|
53
53
|
p: 0,
|
|
54
54
|
}}
|
|
55
55
|
sx={{ border: "none" }}
|
|
56
|
-
Header={
|
|
56
|
+
Header={
|
|
57
57
|
<Flex
|
|
58
58
|
sx={{
|
|
59
59
|
position: "sticky",
|
|
@@ -70,7 +70,7 @@ const ScreenshotPreviewModal: React.FunctionComponent<ScreenshotModalProps> = ({
|
|
|
70
70
|
</Heading>
|
|
71
71
|
<Close type="button" onClick={() => closeModals()} />
|
|
72
72
|
</Flex>
|
|
73
|
-
|
|
73
|
+
}
|
|
74
74
|
Footer={() => (
|
|
75
75
|
<Flex
|
|
76
76
|
style={{
|
|
@@ -2,7 +2,7 @@ import Drawer from "rc-drawer";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Close, Flex, Heading } from "theme-ui";
|
|
4
4
|
|
|
5
|
-
import Card from "@/legacy/components/Card";
|
|
5
|
+
import { Card } from "@/legacy/components/Card";
|
|
6
6
|
|
|
7
7
|
export const SliceMachineDrawerUI: React.FunctionComponent<{
|
|
8
8
|
isOpen: boolean;
|
|
@@ -39,7 +39,7 @@ export const SliceMachineDrawerUI: React.FunctionComponent<{
|
|
|
39
39
|
border: "none",
|
|
40
40
|
}}
|
|
41
41
|
borderFooter
|
|
42
|
-
Header={
|
|
42
|
+
Header={
|
|
43
43
|
<Flex
|
|
44
44
|
sx={{
|
|
45
45
|
p: "16px",
|
|
@@ -55,7 +55,7 @@ export const SliceMachineDrawerUI: React.FunctionComponent<{
|
|
|
55
55
|
</Flex>
|
|
56
56
|
<Close type="button" onClick={() => onClose()} />
|
|
57
57
|
</Flex>
|
|
58
|
-
|
|
58
|
+
}
|
|
59
59
|
Footer={() => (
|
|
60
60
|
<Flex
|
|
61
61
|
sx={{
|