@puzzleitc/puzzle-shell
Version:
The standard design for Puzzle tools
101 lines (94 loc) • 3.15 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { LitElement, css, html } from "lit";
import { customElement } from "lit/decorators/custom-element.js";
import { theme } from "../utils/theme";
// TODO: Expose custom property to set slogan color
// TODO: Optimize for small mobile screens
/**
* Component that contains the application title, slogan and logo, below the header/banner.
*/
let Hero = class Hero extends LitElement {
render() {
return html `
<div class="text">
<slot name="title"></slot>
<slot name="slogan"></slot>
</div>
<div class="logo">
<slot name="logo"></slot>
</div>
`;
}
};
Hero.styles = [
theme,
css `
:host {
height: var(--pzsh-hero-height);
padding: 0 var(--pzsh-page-padding-horizontal-mobile);
display: flex;
align-items: center;
justify-content: center;
gap: var(--pzsh-spacer);
background: var(--pzsh-hero-bg-start);
background: linear-gradient(
180deg,
var(--pzsh-hero-bg-start) 0%,
var(--pzsh-hero-bg-end) 100%
);
}
.text {
max-width: 350px;
/* Move a bit above mathematical center */
margin-bottom: calc(2 * var(--pzsh-spacer));
}
.logo {
max-height: var(--pzsh-hero-height);
}
/**
* When styling the slotted elements in the light DOM, make sure to
* enforce these styles with !important to override any potential
* light DOM styles.
*/
::slotted([slot="title"]),
::slotted([slot="slogan"]) {
font-family: var(--pzsh-font-family) !important;
font-weight: normal !important;
line-height: 1 !important;
}
::slotted([slot="title"]) {
margin: 0 !important;
font-size: 32px !important;
color: var(--pzsh-color-brand-alt-2) !important;
}
::slotted([slot="slogan"]) {
margin-top: var(--pzsh-spacer) !important;
margin-bottom: 0 !important;
font-size: 18px !important;
color: var(--pzsh-color-brand-alt-3) !important;
}
(min-width: 390px) {
:host {
gap: calc(3 * var(--pzsh-spacer));
}
.text {
/* Move a bit above mathematical center */
margin-bottom: calc(6 * var(--pzsh-spacer));
}
}
(min-width: ${theme.breakpoint}px) {
:host {
gap: calc(5 * var(--pzsh-spacer));
}
}
`,
];
Hero = __decorate([
customElement("pzsh-hero")
], Hero);
export { Hero };