slice-machine-ui 1.18.1-dev-next-release.6 → 1.18.1-dev-next-release.7
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/components/ChangesItems/ChangesItems.tsx +5 -3
- package/lib/builders/CustomTypeBuilder/SliceZone/List.tsx +6 -6
- package/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModalList.tsx +5 -2
- package/out/404.html +1 -1
- package/out/_next/static/{wb5LuWvZzzVC8U-R0CeTs → 66ngFr7hhlaxMLWATvuAM}/_buildManifest.js +1 -1
- package/out/_next/static/chunks/7-b30f3180efb6bb5b.js +1 -0
- package/out/_next/static/chunks/904-ae815442efed055f.js +1 -0
- package/out/_next/static/chunks/pages/{_app-9a94be32e790ed15.js → _app-4b020373096131e4.js} +1 -1
- package/out/_next/static/chunks/pages/changes-b0714ca467c05e08.js +1 -0
- package/out/_next/static/chunks/pages/custom-types/{[customTypeId]-1b420cadc2703ffc.js → [customTypeId]-c9ce77d2fccb503f.js} +1 -1
- package/out/_next/static/chunks/pages/page-types/{[pageTypeId]-926e762906e3ab7a.js → [pageTypeId]-c50a43970c50ead1.js} +1 -1
- package/out/_next/static/chunks/pages/{slices-b686960d7d228e36.js → slices-0cd502231524ba59.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/slices/[lib]/[sliceName]/[variation]/screenshot.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 +4 -4
- package/pages/slices.tsx +4 -3
- package/src/components/Card/Card.css.ts +13 -7
- package/src/components/Card/Card.stories.tsx +2 -1
- package/src/components/Card/Card.tsx +51 -38
- package/src/features/slices/convertLegacySlice/ConvertLegacySliceButton.tsx +2 -2
- package/src/features/slices/convertLegacySlice/types.ts +2 -2
- package/src/features/slices/sliceCards/{NonSharedSliceViewCard.tsx → NonSharedSliceCard.tsx} +2 -2
- package/src/features/slices/sliceCards/SharedSliceCard.tsx +240 -0
- package/test/pages/custom-types.test.tsx +1 -1
- package/out/_next/static/chunks/590-ab38d53732035bf0.js +0 -1
- package/out/_next/static/chunks/933-a14914fafa262353.js +0 -1
- package/out/_next/static/chunks/pages/changes-e58a6f4217ec2d9e.js +0 -1
- package/src/features/slices/sliceCards/SharedSliceSelectionCard.tsx +0 -75
- package/src/features/slices/sliceCards/SharedSliceViewCard.tsx +0 -145
- /package/out/_next/static/{wb5LuWvZzzVC8U-R0CeTs → 66ngFr7hhlaxMLWATvuAM}/_ssgManifest.js +0 -0
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Box,
|
|
3
|
-
Button,
|
|
4
|
-
DropdownMenu,
|
|
5
|
-
DropdownMenuContent,
|
|
6
|
-
DropdownMenuItem,
|
|
7
|
-
DropdownMenuTrigger,
|
|
8
|
-
Icon,
|
|
9
|
-
IconButton,
|
|
10
|
-
Text,
|
|
11
|
-
tokens,
|
|
12
|
-
} from "@prismicio/editor-ui";
|
|
13
|
-
import Link from "next/link";
|
|
14
|
-
import type { FC } from "react";
|
|
15
|
-
|
|
16
|
-
import { ComponentUI } from "@lib/models/common/ComponentUI";
|
|
17
|
-
import { Card, CardFooter, CardMedia, CardStatus } from "@src/components/Card";
|
|
18
|
-
import { countMissingScreenshots, getScreenshotUrl } from "@src/domain/slice";
|
|
19
|
-
import {
|
|
20
|
-
StatusBadge,
|
|
21
|
-
type StatusBadgeProps,
|
|
22
|
-
} from "@src/features/changes/StatusBadge";
|
|
23
|
-
import { SLICES_CONFIG } from "@src/features/slices/slicesConfig";
|
|
24
|
-
import { AddPhotoAlternateIcon } from "@src/icons/AddPhotoAlternateIcon";
|
|
25
|
-
|
|
26
|
-
type SharedSliceViewCardProps = {
|
|
27
|
-
action:
|
|
28
|
-
| { type: "menu"; onRemove: () => void; onRename: () => void }
|
|
29
|
-
| { type: "remove"; onRemove: () => void }
|
|
30
|
-
| ({ type: "status" } & Omit<StatusBadgeProps, "modelType">);
|
|
31
|
-
isDeletedSlice: boolean;
|
|
32
|
-
onUpdateScreenshot: (() => void) | undefined;
|
|
33
|
-
slice: ComponentUI;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const SharedSliceViewCard: FC<SharedSliceViewCardProps> = ({
|
|
37
|
-
action,
|
|
38
|
-
isDeletedSlice,
|
|
39
|
-
onUpdateScreenshot,
|
|
40
|
-
slice,
|
|
41
|
-
}) => {
|
|
42
|
-
const defaultVariation = ComponentUI.variation(slice);
|
|
43
|
-
if (!defaultVariation) return null;
|
|
44
|
-
const href = SLICES_CONFIG.getBuilderPagePathname({
|
|
45
|
-
libraryName: slice.href,
|
|
46
|
-
sliceName: slice.model.name,
|
|
47
|
-
variationId: defaultVariation.id,
|
|
48
|
-
});
|
|
49
|
-
const src = getScreenshotUrl(slice, defaultVariation);
|
|
50
|
-
const canUpdateScreenshot = !!onUpdateScreenshot && !isDeletedSlice;
|
|
51
|
-
return (
|
|
52
|
-
<Card
|
|
53
|
-
{...(href !== undefined && !isDeletedSlice
|
|
54
|
-
? { component: Link, href, interactive: true }
|
|
55
|
-
: { interactive: false })}
|
|
56
|
-
>
|
|
57
|
-
{src !== undefined ? (
|
|
58
|
-
<CardMedia
|
|
59
|
-
overlay={
|
|
60
|
-
canUpdateScreenshot ? (
|
|
61
|
-
<Box alignItems="center" justifyContent="center">
|
|
62
|
-
<UpdateScreenshotButton onClick={onUpdateScreenshot} />
|
|
63
|
-
</Box>
|
|
64
|
-
) : undefined
|
|
65
|
-
}
|
|
66
|
-
src={src}
|
|
67
|
-
/>
|
|
68
|
-
) : (
|
|
69
|
-
<CardMedia component="div">
|
|
70
|
-
<Box
|
|
71
|
-
alignItems="center"
|
|
72
|
-
flexDirection="column"
|
|
73
|
-
gap={8}
|
|
74
|
-
justifyContent="center"
|
|
75
|
-
>
|
|
76
|
-
<Text color="grey11" component="span">
|
|
77
|
-
No screenshot available
|
|
78
|
-
</Text>
|
|
79
|
-
{canUpdateScreenshot ? (
|
|
80
|
-
<UpdateScreenshotButton onClick={onUpdateScreenshot} />
|
|
81
|
-
) : undefined}
|
|
82
|
-
</Box>
|
|
83
|
-
</CardMedia>
|
|
84
|
-
)}
|
|
85
|
-
<CardFooter
|
|
86
|
-
action={
|
|
87
|
-
action.type === "menu" ? (
|
|
88
|
-
<DropdownMenu modal>
|
|
89
|
-
<DropdownMenuTrigger>
|
|
90
|
-
<IconButton icon="moreVert" />
|
|
91
|
-
</DropdownMenuTrigger>
|
|
92
|
-
<DropdownMenuContent align="end">
|
|
93
|
-
<DropdownMenuItem
|
|
94
|
-
onSelect={action.onRename}
|
|
95
|
-
startIcon={<Icon name="edit" />}
|
|
96
|
-
>
|
|
97
|
-
Rename
|
|
98
|
-
</DropdownMenuItem>
|
|
99
|
-
<DropdownMenuItem
|
|
100
|
-
color="tomato"
|
|
101
|
-
onSelect={action.onRemove}
|
|
102
|
-
startIcon={<Icon name="delete" />}
|
|
103
|
-
>
|
|
104
|
-
Delete
|
|
105
|
-
</DropdownMenuItem>
|
|
106
|
-
</DropdownMenuContent>
|
|
107
|
-
</DropdownMenu>
|
|
108
|
-
) : action.type === "remove" ? (
|
|
109
|
-
<IconButton icon="close" onClick={action.onRemove} />
|
|
110
|
-
) : (
|
|
111
|
-
<StatusBadge
|
|
112
|
-
authStatus={action.authStatus}
|
|
113
|
-
isOnline={action.isOnline}
|
|
114
|
-
modelStatus={action.modelStatus}
|
|
115
|
-
modelType="Slice"
|
|
116
|
-
/>
|
|
117
|
-
)
|
|
118
|
-
}
|
|
119
|
-
subtitle={`${slice.model.variations.length} variation${
|
|
120
|
-
slice.model.variations.length > 1 ? "s" : ""
|
|
121
|
-
}`}
|
|
122
|
-
title={slice.model.name}
|
|
123
|
-
/>
|
|
124
|
-
{canUpdateScreenshot && countMissingScreenshots(slice) > 0 ? (
|
|
125
|
-
<CardStatus>Missing screenshot</CardStatus>
|
|
126
|
-
) : undefined}
|
|
127
|
-
</Card>
|
|
128
|
-
);
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
type UpdateScreenshotButtonProps = {
|
|
132
|
-
onClick: () => void;
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
const UpdateScreenshotButton: FC<UpdateScreenshotButtonProps> = (props) => (
|
|
136
|
-
<Button
|
|
137
|
-
onClick={props.onClick}
|
|
138
|
-
renderStartIcon={() => (
|
|
139
|
-
<AddPhotoAlternateIcon color={tokens.color.greyLight11} />
|
|
140
|
-
)}
|
|
141
|
-
variant="secondary"
|
|
142
|
-
>
|
|
143
|
-
Update screenshot
|
|
144
|
-
</Button>
|
|
145
|
-
);
|
|
File without changes
|