Update Style of Design Page (#11982)

This commit is contained in:
Zack Barett 2022-03-08 12:19:18 -06:00 committed by GitHub
parent db830e9014
commit d968fe41ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 76 additions and 41 deletions

View File

@ -12,7 +12,14 @@ class PageDescription extends HaMarkdown {
if (!PAGES[this.page].description) { if (!PAGES[this.page].description) {
return html``; return html``;
} }
return html` return html`
<div class="heading">
<div class="title">
${PAGES[this.page].metadata.title || this.page.split("/")[1]}
</div>
<div class="subtitle">${PAGES[this.page].metadata.subtitle}</div>
</div>
${until( ${until(
PAGES[this.page] PAGES[this.page]
.description() .description()
@ -25,9 +32,22 @@ class PageDescription extends HaMarkdown {
static styles = [ static styles = [
HaMarkdown.styles, HaMarkdown.styles,
css` css`
.heading {
padding: 16px;
border-bottom: 1px solid var(--secondary-background-color);
}
.title {
font-size: 42px;
line-height: 56px;
padding-bottom: 8px;
}
.subtitle {
font-size: 18px;
line-height: 24px;
}
.root { .root {
max-width: 800px; max-width: 800px;
margin: 0 auto; margin: 16px auto;
} }
.root > *:first-child { .root > *:first-child {
margin-top: 0; margin-top: 0;

View File

@ -5,6 +5,7 @@ import { html, css, LitElement, PropertyValues } from "lit";
import { customElement, property, query } from "lit/decorators"; import { customElement, property, query } from "lit/decorators";
import "../../src/components/ha-icon-button"; import "../../src/components/ha-icon-button";
import "../../src/managers/notification-manager"; import "../../src/managers/notification-manager";
import "../../src/components/ha-expansion-panel";
import { haStyle } from "../../src/resources/styles"; import { haStyle } from "../../src/resources/styles";
import { PAGES, SIDEBAR } from "../build/import-pages"; import { PAGES, SIDEBAR } from "../build/import-pages";
import { dynamicElement } from "../../src/common/dom/dynamic-element-directive"; import { dynamicElement } from "../../src/common/dom/dynamic-element-directive";
@ -53,10 +54,9 @@ class HaGallery extends LitElement {
sidebar.push( sidebar.push(
group.header group.header
? html` ? html`
<details> <ha-expansion-panel .header=${group.header}>
<summary class="section">${group.header}</summary>
${links} ${links}
</details> </ha-expansion-panel>
` `
: links : links
); );
@ -92,6 +92,12 @@ class HaGallery extends LitElement {
${dynamicElement(`demo-${this._page.replace("/", "-")}`)} ${dynamicElement(`demo-${this._page.replace("/", "-")}`)}
</div> </div>
<div class="page-footer"> <div class="page-footer">
<div class="header">Help us to improve our documentation</div>
<div class="secondary">
Suggest an edit to this page, or provide/view feedback for this
page.
</div>
<div>
${PAGES[this._page].description || ${PAGES[this._page].description ||
Object.keys(PAGES[this._page].metadata).length > 0 Object.keys(PAGES[this._page].metadata).length > 0
? html` ? html`
@ -115,6 +121,7 @@ class HaGallery extends LitElement {
: ""} : ""}
</div> </div>
</div> </div>
</div>
</mwc-drawer> </mwc-drawer>
<notification-manager <notification-manager
.hass=${FAKE_HASS} .hass=${FAKE_HASS}
@ -186,27 +193,16 @@ class HaGallery extends LitElement {
padding: 4px; padding: 4px;
} }
.sidebar details {
margin-top: 1em;
margin-left: 1em;
}
.sidebar summary {
cursor: pointer;
font-weight: bold;
margin-bottom: 8px;
}
.sidebar a { .sidebar a {
color: var(--primary-text-color); color: var(--primary-text-color);
display: block; display: block;
padding: 4px 12px; padding: 12px;
text-decoration: none; text-decoration: none;
position: relative; position: relative;
} }
.sidebar a[active]::before { .sidebar a[active]::before {
border-radius: 4px; border-radius: 12px;
position: absolute; position: absolute;
top: 0; top: 0;
right: 2px; right: 2px;
@ -237,14 +233,32 @@ class HaGallery extends LitElement {
.page-footer { .page-footer {
text-align: center; text-align: center;
margin: 16px 0; margin: 16px;
padding-top: 16px; padding: 16px;
border-top: 1px solid rgba(0, 0, 0, 0.12); border-radius: 12px;
background-color: var(--primary-background-color);
}
.page-footer div {
margin-top: 4px;
}
.page-footer .header {
font-size: 16px;
font-weight: 500;
line-height: 28px;
text-align: center;
}
.page-footer .secondary {
line-height: 23px;
text-align: center;
} }
.page-footer a { .page-footer a {
display: inline-block; display: inline-block;
margin: 0 8px; margin: 0 8px;
text-decoration: none;
} }
`, `,
]; ];

View File

@ -1,5 +1,6 @@
--- ---
title: Alerts title: Alerts
subtitle: An alert displays a short, important message in a way that attracts the user's attention without interrupting the user's task.
--- ---
# Alert `<ha-alert>` # Alert `<ha-alert>`