|
1 | 1 | import { hidePropertiesIn, Properties } from "@mendix/pluggable-widgets-tools"; |
2 | 2 | import { |
3 | 3 | StructurePreviewProps, |
4 | | - structurePreviewPalette |
| 4 | + structurePreviewPalette, |
| 5 | + rowLayout, |
| 6 | + container, |
| 7 | + text |
5 | 8 | } from "@mendix/widget-plugin-platform/preview/structure-preview-api"; |
6 | 9 | import { ImageCropperPreviewProps } from "../typings/ImageCropperProps"; |
7 | 10 | import { describeConfig } from "./utils/describeConfig"; |
@@ -32,42 +35,13 @@ export function getProperties(values: ImageCropperPreviewProps, defaultPropertie |
32 | 35 | export function getPreview(values: ImageCropperPreviewProps, isDarkMode: boolean): StructurePreviewProps { |
33 | 36 | const palette = structurePreviewPalette[isDarkMode ? "dark" : "light"]; |
34 | 37 |
|
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 | + ); |
71 | 45 | } |
72 | 46 |
|
73 | 47 | export function getCustomCaption(values: ImageCropperPreviewProps): string { |
|
0 commit comments