|
1 | 1 | import { |
2 | | - StructurePreviewProps, |
3 | 2 | container, |
| 3 | + image, |
4 | 4 | rowLayout, |
5 | 5 | structurePreviewPalette, |
| 6 | + StructurePreviewProps, |
6 | 7 | text |
7 | 8 | } from "@mendix/widget-plugin-platform/preview/structure-preview-api"; |
8 | 9 | import { Properties, hidePropertyIn, hidePropertiesIn } from "@mendix/pluggable-widgets-tools"; |
9 | 10 | import { CalendarPreviewProps } from "../typings/CalendarProps"; |
| 11 | +import IconSVGDark from "./assets/StructureCalendarDark.svg"; |
| 12 | +import IconSVG from "./assets/StructureCalendarLight.svg"; |
10 | 13 |
|
11 | 14 | export function getProperties(values: CalendarPreviewProps, defaultProperties: Properties): Properties { |
12 | 15 | if (values.heightUnit === "percentageOfWidth") { |
@@ -41,10 +44,25 @@ export function getProperties(values: CalendarPreviewProps, defaultProperties: P |
41 | 44 |
|
42 | 45 | export function getPreview(_values: CalendarPreviewProps, isDarkMode: boolean): StructurePreviewProps { |
43 | 46 | const palette = structurePreviewPalette[isDarkMode ? "dark" : "light"]; |
| 47 | + const readOnly = _values.readOnly; |
44 | 48 |
|
45 | | - return rowLayout({ columnSize: "grow", borders: true, backgroundColor: palette.background.containerFill })( |
46 | | - container()(), |
47 | | - rowLayout({ grow: 2, padding: 8 })(text({ fontColor: palette.text.primary, grow: 10 })("calendar")), |
48 | | - container()() |
| 49 | + return container({ grow: 0 })( |
| 50 | + rowLayout({ |
| 51 | + backgroundColor: readOnly ? palette.background.containerDisabled : palette.background.topbarData, |
| 52 | + borders: true, |
| 53 | + columnSize: "grow", |
| 54 | + grow: 0 |
| 55 | + })( |
| 56 | + container({ grow: 0 })( |
| 57 | + container({ grow: 0, padding: 1 })( |
| 58 | + image( |
| 59 | + decodeURIComponent((isDarkMode ? IconSVGDark : IconSVG).replace("data:image/svg+xml,", "")), |
| 60 | + 16, |
| 61 | + 16 |
| 62 | + ) |
| 63 | + ), |
| 64 | + text({ fontColor: palette.text.primary, grow: 0 })("Calendar") |
| 65 | + ) |
| 66 | + ) |
49 | 67 | ); |
50 | 68 | } |
0 commit comments