Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Add full width to mdc-switch

Robin Dekkers945276887d82
diff --git a/ui/component/or-mwc-components/src/or-mwc-input.ts b/ui/component/or-mwc-components/src/or-mwc-input.ts
index 7f0ba2a37..31e53a51a 100644
--- a/ui/component/or-mwc-components/src/or-mwc-input.ts
+++ b/ui/component/or-mwc-components/src/or-mwc-input.ts
@@ -569,8 +569,12 @@ const style = css`
.mdc-switch {
margin: 0 24px;
}
+
+ .mdc-switch--full-width {
+ margin-left: auto;
+ }
- #field {
+ #field {
height: 100%;
}
@@ -855,10 +859,16 @@ export class OrMwcInput extends LitElement {
`;
break;
case InputType.SWITCH:
+ const classesSwitch = {
+ "mdc-switch--disabled": this.disabled || this.readonly,
+ "mdc-switch--full-width": this.fullWidth,
+ "mdc-switch--checked": this.value,
+ };
+
return html`
<span id="wrapper">
${this.label ? html`<label for="elem" class="${this.disabled ? "mdc-switch--disabled" : ""}">${this.label}</label>` : ``}
- <div id="component" class="mdc-switch ${this.disabled || this.readonly ? "mdc-switch--disabled" : ""} ${this.value ? "mdc-switch--checked" : ""}">
+ <div id="component" class="mdc-switch ${classMap(classesSwitch)}">
<div class="mdc-switch__track"></div>
<div class="mdc-switch__thumb-underlay">
<div class="mdc-switch__thumb">