Header/sidebar sizing (#7470)

Co-authored-by: Zack Barett <zackbarett@hey.com>
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
Ryan Meek 2020-11-11 04:47:06 -05:00 committed by GitHub
parent 6cd3e6652a
commit 216fce74f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 48 additions and 39 deletions

View File

@ -320,13 +320,11 @@ class HaSidebar extends LitElement {
</mwc-icon-button> </mwc-icon-button>
` `
: ""} : ""}
<div class="title"> ${this.editMode
${this.editMode ? html`<mwc-button outlined @click=${this._closeEditMode}>
? html`<mwc-button outlined @click=${this._closeEditMode}> ${this.hass.localize("ui.sidebar.done")}
${this.hass.localize("ui.sidebar.done")} </mwc-button>`
</mwc-button>` : html`<div class="title">Home Assistant</div>`}
: "Home Assistant"}
</div>
</div>`; </div>`;
} }
@ -756,7 +754,7 @@ class HaSidebar extends LitElement {
-moz-user-select: none; -moz-user-select: none;
border-right: 1px solid var(--divider-color); border-right: 1px solid var(--divider-color);
background-color: var(--sidebar-background-color); background-color: var(--sidebar-background-color);
width: 64px; width: 56px;
} }
:host([expanded]) { :host([expanded]) {
width: 256px; width: 256px;
@ -768,8 +766,9 @@ class HaSidebar extends LitElement {
} }
.menu { .menu {
height: var(--header-height); height: var(--header-height);
box-sizing: border-box;
display: flex; display: flex;
padding: 0 8.5px; padding: 0 4px;
border-bottom: 1px solid transparent; border-bottom: 1px solid transparent;
white-space: nowrap; white-space: nowrap;
font-weight: 400; font-weight: 400;
@ -778,11 +777,11 @@ class HaSidebar extends LitElement {
background-color: var(--primary-background-color); background-color: var(--primary-background-color);
font-size: 20px; font-size: 20px;
align-items: center; align-items: center;
padding-left: calc(8.5px + env(safe-area-inset-left)); padding-left: calc(4px + env(safe-area-inset-left));
} }
:host([rtl]) .menu { :host([rtl]) .menu {
padding-left: 8.5px; padding-left: 4px;
padding-right: calc(8.5px + env(safe-area-inset-right)); padding-right: calc(4px + env(safe-area-inset-right));
} }
:host([expanded]) .menu { :host([expanded]) .menu {
width: calc(256px + env(safe-area-inset-left)); width: calc(256px + env(safe-area-inset-left));
@ -793,26 +792,27 @@ class HaSidebar extends LitElement {
.menu mwc-icon-button { .menu mwc-icon-button {
color: var(--sidebar-icon-color); color: var(--sidebar-icon-color);
} }
:host([expanded]) .menu mwc-icon-button {
margin-right: 23px;
}
:host([expanded][rtl]) .menu mwc-icon-button {
margin-right: 0px;
margin-left: 23px;
}
.title { .title {
margin-left: 19px;
width: 100%; width: 100%;
display: none; display: none;
} }
:host([rtl]) .title {
margin-left: 0;
margin-right: 19px;
}
:host([narrow]) .title { :host([narrow]) .title {
margin: 0;
padding: 0 16px; padding: 0 16px;
} }
:host([expanded]) .title { :host([expanded]) .title {
display: initial; display: initial;
} }
.title mwc-button { :host([expanded]) .menu mwc-button {
width: 90%; margin: 0 8px;
}
.menu mwc-button {
width: 100%;
} }
#sortable, #sortable,
.hidden-panel { .hidden-panel {
@ -850,14 +850,14 @@ class HaSidebar extends LitElement {
paper-icon-item { paper-icon-item {
box-sizing: border-box; box-sizing: border-box;
margin: 4px 8px; margin: 4px;
padding-left: 12px; padding-left: 12px;
border-radius: 4px; border-radius: 4px;
--paper-item-min-height: 40px; --paper-item-min-height: 40px;
width: 48px; width: 48px;
} }
:host([expanded]) paper-icon-item { :host([expanded]) paper-icon-item {
width: 240px; width: 248px;
} }
:host([rtl]) paper-icon-item { :host([rtl]) paper-icon-item {
padding-left: auto; padding-left: auto;
@ -874,9 +874,9 @@ class HaSidebar extends LitElement {
border-radius: 4px; border-radius: 4px;
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 2px;
bottom: 0; bottom: 0;
left: 0; left: 2px;
pointer-events: none; pointer-events: none;
content: ""; content: "";
transition: opacity 15ms linear; transition: opacity 15ms linear;

View File

@ -101,11 +101,10 @@ export class HaTab extends LitElement {
text-align: center; text-align: center;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: 64px; height: var(--header-height);
cursor: pointer; cursor: pointer;
position: relative; position: relative;
outline: none; outline: none;
box-sizing: border-box;
} }
.name { .name {

View File

@ -34,8 +34,8 @@ export class HaTabs extends PaperTabs {
superStyle!.appendChild( superStyle!.appendChild(
document.createTextNode(` document.createTextNode(`
:host { #selectionBar {
padding-top: .5px; box-sizing: border-box;
} }
.not-visible { .not-visible {
display: none; display: none;

View File

@ -25,8 +25,8 @@ export class HuiNotificationDrawer extends EventsMixin(
color: var(--primary-text-color); color: var(--primary-text-color);
border-bottom: 1px solid var(--divider-color); border-bottom: 1px solid var(--divider-color);
background-color: var(--primary-background-color); background-color: var(--primary-background-color);
min-height: 64px; height: var(--header-height);
width: calc(100% - 32px); box-sizing: border-box;
} }
div[main-title] { div[main-title] {

View File

@ -54,7 +54,7 @@ class HassErrorScreen extends LitElement {
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 20px; font-size: 20px;
height: 65px; height: var(--header-height);
padding: 0 16px; padding: 0 16px;
pointer-events: none; pointer-events: none;
background-color: var(--app-header-background-color); background-color: var(--app-header-background-color);

View File

@ -67,7 +67,7 @@ class HassLoadingScreen extends LitElement {
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 20px; font-size: 20px;
height: 65px; height: var(--header-height);
padding: 0 16px; padding: 0 16px;
pointer-events: none; pointer-events: none;
background-color: var(--app-header-background-color); background-color: var(--app-header-background-color);

View File

@ -69,7 +69,7 @@ class HassSubpage extends LitElement {
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 20px; font-size: 20px;
height: 65px; height: var(--header-height);
padding: 0 16px; padding: 0 16px;
pointer-events: none; pointer-events: none;
background-color: var(--app-header-background-color); background-color: var(--app-header-background-color);

View File

@ -217,7 +217,7 @@ class HassTabsSubpage extends LitElement {
display: flex; display: flex;
align-items: center; align-items: center;
font-size: 20px; font-size: 20px;
height: 65px; height: var(--header-height);
background-color: var(--sidebar-background-color); background-color: var(--sidebar-background-color);
font-weight: 400; font-weight: 400;
color: var(--sidebar-text-color); color: var(--sidebar-text-color);

View File

@ -192,7 +192,7 @@ class HomeAssistantMain extends LitElement {
color: var(--primary-text-color); color: var(--primary-text-color);
/* remove the grey tap highlights in iOS on the fullscreen touch targets */ /* remove the grey tap highlights in iOS on the fullscreen touch targets */
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
--app-drawer-width: 64px; --app-drawer-width: 56px;
} }
:host([expanded]) { :host([expanded]) {
--app-drawer-width: calc(256px + env(safe-area-inset-left)); --app-drawer-width: calc(256px + env(safe-area-inset-left));

View File

@ -73,15 +73,25 @@ export const sortableStyles = css`
display: none; display: none;
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 4px;
--mdc-icon-button-size: 40px; --mdc-icon-button-size: 40px;
} }
:host([rtl]) .show-panel {
right: initial;
left: 4px;
}
.hide-panel { .hide-panel {
top: 4px; top: 4px;
right: 8px; right: 8px;
} }
:host([rtl]) .hide-panel {
right: initial;
left: 8px;
}
:host([expanded]) .hide-panel { :host([expanded]) .hide-panel {
display: block; display: block;
} }

View File

@ -49,7 +49,7 @@ documentContainer.innerHTML = `<custom-style>
--secondary-background-color: #e5e5e5; /* behind the cards on state */ --secondary-background-color: #e5e5e5; /* behind the cards on state */
/* for header */ /* for header */
--header-height: 64px; --header-height: 56px;
/* for label-badge */ /* for label-badge */
--label-badge-red: #DF4C1E; --label-badge-red: #DF4C1E;