mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
Make dialogs full width on mobile, and modal (#4642)
* Make dialogs full width on mobile, and modal * Fix dialog to bottom screen mobile
This commit is contained in:
parent
adec2fc2df
commit
7021fd5809
@ -16,6 +16,9 @@ export class HaDialog extends MwcDialog {
|
|||||||
.mdc-dialog__actions {
|
.mdc-dialog__actions {
|
||||||
justify-content: var(--justify-action-buttons, flex-end);
|
justify-content: var(--justify-action-buttons, flex-end);
|
||||||
}
|
}
|
||||||
|
.mdc-dialog__container {
|
||||||
|
align-items: var(--vertial-align-dialog, center);
|
||||||
|
}
|
||||||
`,
|
`,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -55,13 +55,26 @@ class DialogPersonDetail extends LitElement {
|
|||||||
return html``;
|
return html``;
|
||||||
}
|
}
|
||||||
const nameInvalid = this._name.trim() === "";
|
const nameInvalid = this._name.trim() === "";
|
||||||
|
const title = html`
|
||||||
|
${this._params.entry
|
||||||
|
? this._params.entry.name
|
||||||
|
: this.hass!.localize("ui.panel.config.person.detail.new_person")}
|
||||||
|
<paper-icon-button
|
||||||
|
aria-label=${this.hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_flow.dismiss"
|
||||||
|
)}
|
||||||
|
icon="hass:close"
|
||||||
|
dialogAction="close"
|
||||||
|
style="position: absolute; right: 16px; top: 12px;"
|
||||||
|
></paper-icon-button>
|
||||||
|
`;
|
||||||
return html`
|
return html`
|
||||||
<ha-dialog
|
<ha-dialog
|
||||||
open
|
open
|
||||||
@closing="${this._close}"
|
@closing="${this._close}"
|
||||||
.title=${this._params.entry
|
scrimClickAction=""
|
||||||
? this._params.entry.name
|
escapeKeyAction=""
|
||||||
: this.hass!.localize("ui.panel.config.person.detail.new_person")}
|
.title=${title}
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
${this._error
|
${this._error
|
||||||
@ -225,11 +238,20 @@ class DialogPersonDetail extends LitElement {
|
|||||||
return [
|
return [
|
||||||
css`
|
css`
|
||||||
ha-dialog {
|
ha-dialog {
|
||||||
min-width: 400px;
|
--mdc-dialog-min-width: 400px;
|
||||||
max-width: 600px;
|
--mdc-dialog-max-width: 600px;
|
||||||
--mdc-dialog-title-ink-color: var(--primary-text-color);
|
--mdc-dialog-title-ink-color: var(--primary-text-color);
|
||||||
--justify-action-buttons: space-between;
|
--justify-action-buttons: space-between;
|
||||||
}
|
}
|
||||||
|
/* make dialog fullscreen on small screens */
|
||||||
|
@media all and (max-width: 450px), all and (max-height: 500px) {
|
||||||
|
ha-dialog {
|
||||||
|
--mdc-dialog-min-width: 100vw;
|
||||||
|
--mdc-dialog-max-height: 100vh;
|
||||||
|
--mdc-dialog-shape-radius: 0px;
|
||||||
|
--vertial-align-dialog: flex-end;
|
||||||
|
}
|
||||||
|
}
|
||||||
.form {
|
.form {
|
||||||
padding-bottom: 24px;
|
padding-bottom: 24px;
|
||||||
}
|
}
|
||||||
|
@ -62,13 +62,26 @@ class DialogZoneDetail extends LitElement {
|
|||||||
if (!this._params) {
|
if (!this._params) {
|
||||||
return html``;
|
return html``;
|
||||||
}
|
}
|
||||||
|
const title = html`
|
||||||
|
${this._params.entry
|
||||||
|
? this._params.entry.name
|
||||||
|
: this.hass!.localize("ui.panel.config.zone.detail.new_zone")}
|
||||||
|
<paper-icon-button
|
||||||
|
aria-label=${this.hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_flow.dismiss"
|
||||||
|
)}
|
||||||
|
icon="hass:close"
|
||||||
|
dialogAction="close"
|
||||||
|
style="position: absolute; right: 16px; top: 12px;"
|
||||||
|
></paper-icon-button>
|
||||||
|
`;
|
||||||
return html`
|
return html`
|
||||||
<ha-dialog
|
<ha-dialog
|
||||||
open
|
open
|
||||||
@closing="${this._close}"
|
@closing="${this._close}"
|
||||||
.title=${this._params.entry
|
scrimClickAction=""
|
||||||
? this._params.entry.name
|
escapeKeyAction=""
|
||||||
: this.hass!.localize("ui.panel.config.zone.detail.new_zone")}
|
.title=${title}
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
${this._error
|
${this._error
|
||||||
@ -252,6 +265,16 @@ class DialogZoneDetail extends LitElement {
|
|||||||
--mdc-dialog-min-width: 600px;
|
--mdc-dialog-min-width: 600px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* make dialog fullscreen on small screens */
|
||||||
|
@media all and (max-width: 450px), all and (max-height: 500px) {
|
||||||
|
ha-dialog {
|
||||||
|
--mdc-dialog-min-width: 100vw;
|
||||||
|
--mdc-dialog-max-height: 100vh;
|
||||||
|
--mdc-dialog-shape-radius: 0px;
|
||||||
|
--vertial-align-dialog: flex-end;
|
||||||
|
}
|
||||||
|
}
|
||||||
.form {
|
.form {
|
||||||
padding-bottom: 24px;
|
padding-bottom: 24px;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user