Skip to content

Commit 11f57e2

Browse files
authored
[MOO-2018]: fix the visibility of lable position option (#457)
2 parents ff98f43 + f8c9407 commit 11f57e2

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

packages/pluggableWidgets/switch-native/src/Switch.editorConfig.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,11 @@ export function getPreview(values: SwitchPreviewProps, isDarkMode: boolean): Str
2424
document: decodeURIComponent(
2525
(isDarkMode ? StructurePreviewSwitchDarkSVG : StructurePreviewSwitchSVG).replace("data:image/svg+xml,", "")
2626
),
27-
width: 80,
27+
width: 51,
2828
height: 30,
2929
grow: 8
3030
};
31-
const children = values.showLabel ? [label, image] : [image];
32-
31+
const children = values.showLabel ? (values.labelPosition === "right" ? [image, label] : [label, image]) : [image];
3332
return values.labelOrientation === "horizontal"
3433
? {
3534
type: "RowLayout",
@@ -48,7 +47,11 @@ export function getPreview(values: SwitchPreviewProps, isDarkMode: boolean): Str
4847

4948
export function getProperties(values: SwitchPreviewProps, defaultProperties: Properties): Properties {
5049
if (!values.showLabel) {
51-
hidePropertiesIn(defaultProperties, values, ["label", "labelOrientation"]);
50+
hidePropertiesIn(defaultProperties, values, ["label", "labelOrientation", "labelPosition"]);
51+
}
52+
53+
if (values.showLabel && values.labelOrientation !== "horizontal") {
54+
hidePropertiesIn(defaultProperties, values, ["labelPosition"]);
5255
}
5356

5457
return defaultProperties;

0 commit comments

Comments
 (0)