Skip to content

Commit ba3257f

Browse files
committed
chore: align the structure preview with other widgets
1 parent 94f90e8 commit ba3257f

2 files changed

Lines changed: 12 additions & 38 deletions

File tree

packages/pluggableWidgets/image-cropper-web/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Image Crop
1+
# Image Cropper
22

33
Crops images bound to a Mendix image attribute. The cropped result is written back to the same attribute.
44

packages/pluggableWidgets/image-cropper-web/src/ImageCropper.editorConfig.ts

Lines changed: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { hidePropertiesIn, Properties } from "@mendix/pluggable-widgets-tools";
22
import {
33
StructurePreviewProps,
4-
structurePreviewPalette
4+
structurePreviewPalette,
5+
rowLayout,
6+
container,
7+
text
58
} from "@mendix/widget-plugin-platform/preview/structure-preview-api";
69
import { ImageCropperPreviewProps } from "../typings/ImageCropperProps";
710
import { describeConfig } from "./utils/describeConfig";
@@ -32,42 +35,13 @@ export function getProperties(values: ImageCropperPreviewProps, defaultPropertie
3235
export function getPreview(values: ImageCropperPreviewProps, isDarkMode: boolean): StructurePreviewProps {
3336
const palette = structurePreviewPalette[isDarkMode ? "dark" : "light"];
3437

35-
return {
36-
type: "Container",
37-
borders: true,
38-
borderRadius: 4,
39-
backgroundColor: palette.background.container,
40-
children: [
41-
{
42-
type: "RowLayout",
43-
columnSize: "grow",
44-
backgroundColor: palette.background.topbarStandard,
45-
borders: true,
46-
borderWidth: 1,
47-
padding: 8,
48-
children: [
49-
{
50-
type: "Text",
51-
content: "Image cropper",
52-
fontColor: palette.text.primary,
53-
fontSize: 10
54-
}
55-
]
56-
},
57-
{
58-
type: "Container",
59-
padding: 8,
60-
children: [
61-
{
62-
type: "Text",
63-
content: values.image ? describeConfig(values) : "[No attribute selected]",
64-
fontColor: palette.text.secondary,
65-
fontSize: 9
66-
}
67-
]
68-
}
69-
]
70-
};
38+
const previewCaption = values.image ? `[${describeConfig(values)}] Image Cropper` : "[Configure Image Cropper]";
39+
40+
return rowLayout({ columnSize: "grow", borders: true, backgroundColor: palette.background.containerFill })(
41+
container()(),
42+
rowLayout({ grow: 2, padding: 8 })(text({ fontColor: palette.text.primary, grow: 10 })(previewCaption)),
43+
container()()
44+
);
7145
}
7246

7347
export function getCustomCaption(values: ImageCropperPreviewProps): string {

0 commit comments

Comments
 (0)