Skip to content

Commit 7bb76ff

Browse files
feat(calendar-web): update structure mode on calendar
1 parent 83cff6d commit 7bb76ff

File tree

3 files changed

+35
-5
lines changed

3 files changed

+35
-5
lines changed

packages/pluggableWidgets/calendar-web/src/Calendar.editorConfig.ts

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import {
2-
StructurePreviewProps,
32
container,
3+
image,
44
rowLayout,
55
structurePreviewPalette,
6+
StructurePreviewProps,
67
text
78
} from "@mendix/widget-plugin-platform/preview/structure-preview-api";
89
import { Properties, hidePropertyIn, hidePropertiesIn } from "@mendix/pluggable-widgets-tools";
910
import { CalendarPreviewProps } from "../typings/CalendarProps";
11+
import IconSVGDark from "./assets/StructureCalendarDark.svg";
12+
import IconSVG from "./assets/StructureCalendarLight.svg";
1013

1114
export function getProperties(values: CalendarPreviewProps, defaultProperties: Properties): Properties {
1215
if (values.heightUnit === "percentageOfWidth") {
@@ -41,10 +44,25 @@ export function getProperties(values: CalendarPreviewProps, defaultProperties: P
4144

4245
export function getPreview(_values: CalendarPreviewProps, isDarkMode: boolean): StructurePreviewProps {
4346
const palette = structurePreviewPalette[isDarkMode ? "dark" : "light"];
47+
const readOnly = _values.readOnly;
4448

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+
)
4967
);
5068
}
Lines changed: 6 additions & 0 deletions
Loading
Lines changed: 6 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)