RTL fix for obstructed notification drawer (#2584)

This commit is contained in:
yosilevy 2019-01-28 19:57:58 +02:00 committed by Paulus Schoutsen
parent fa3889b549
commit fd4ede39ba

View File

@ -9,6 +9,7 @@ import "./hui-notification-item";
import EventsMixin from "../../../../mixins/events-mixin"; import EventsMixin from "../../../../mixins/events-mixin";
import LocalizeMixin from "../../../../mixins/localize-mixin"; import LocalizeMixin from "../../../../mixins/localize-mixin";
import { computeRTL } from "../../../../common/util/compute_rtl";
/* /*
* @appliesMixin EventsMixin * @appliesMixin EventsMixin
@ -47,20 +48,38 @@ export class HuiNotificationDrawer extends EventsMixin(
z-index: 10; z-index: 10;
} }
:host([rtl]) .container {
transition: left .2s ease-in !important;
}
:host(:not(narrow)) .container { :host(:not(narrow)) .container {
right: -500px; right: -500px;
} }
:host([rtl]:not(narrow)) .container {
left: -500px;
}
:host([narrow]) .container { :host([narrow]) .container {
right: -100%; right: -100%;
width: 100%; width: 100%;
} }
:host([rtl][narrow]) .container {
left: -100%;
width: 100%;
}
:host(.open) .container, :host(.open) .container,
:host(.open[narrow]) .container { :host(.open[narrow]) .container {
right: 0; right: 0;
} }
:host([rtl].open) .container,
:host([rtl].open[narrow]) .container {
left: 0;
}
app-toolbar { app-toolbar {
color: var(--primary-text-color); color: var(--primary-text-color);
border-bottom: 1px solid var(--divider-color); border-bottom: 1px solid var(--divider-color);
@ -143,6 +162,11 @@ export class HuiNotificationDrawer extends EventsMixin(
type: Array, type: Array,
value: [], value: [],
}, },
rtl: {
type: Boolean,
reflectToAttribute: true,
computed: "_computeRTL(hass)",
},
}; };
} }
@ -171,5 +195,9 @@ export class HuiNotificationDrawer extends EventsMixin(
}, 250); }, 250);
} }
} }
_computeRTL(hass) {
return computeRTL(hass);
}
} }
customElements.define("hui-notification-drawer", HuiNotificationDrawer); customElements.define("hui-notification-drawer", HuiNotificationDrawer);