Files
catalog/ts_web/elements/upl-statuspage-pagetitle.ts

89 lines
2.1 KiB
TypeScript

import { DeesElement, property, html, customElement, type TemplateResult, css, cssManager, unsafeCSS } from '@design.estate/dees-element';
import * as domtools from '@design.estate/dees-domtools';
import * as sharedStyles from '../styles/shared.styles.js';
import { demoFunc } from './upl-statuspage-pagetitle.demo.js';
declare global {
interface HTMLElementTagNameMap {
'upl-statuspage-pagetitle': UplStatuspagePagetitle;
}
}
@customElement('upl-statuspage-pagetitle')
export class UplStatuspagePagetitle extends DeesElement {
public static demo = demoFunc;
@property({ type: String })
accessor pageTitle: string = 'System Status';
@property({ type: String })
accessor pageSubtitle: string = '';
@property({ type: Boolean })
accessor centered: boolean = false;
constructor() {
super();
}
public static styles = [
domtools.elementBasic.staticStyles,
css`
:host {
display: block;
font-family: ${unsafeCSS(sharedStyles.fonts.base)};
}
.title-container {
max-width: 1200px;
margin: 0 auto;
padding: ${unsafeCSS(sharedStyles.spacing.lg)};
}
.title-container.centered {
text-align: center;
}
h1 {
font-size: 48px;
font-weight: 700;
letter-spacing: -0.03em;
line-height: 1.1;
color: ${sharedStyles.colors.text.primary};
margin: 0 0 ${unsafeCSS(sharedStyles.spacing.md)} 0;
}
p {
font-size: 18px;
color: ${sharedStyles.colors.text.secondary};
margin: 0;
line-height: 1.6;
}
@media (max-width: 640px) {
.title-container {
padding: ${unsafeCSS(sharedStyles.spacing.lg)} ${unsafeCSS(sharedStyles.spacing.md)};
}
h1 {
font-size: 32px;
}
p {
font-size: 16px;
}
}
`
]
public render(): TemplateResult {
return html`
<div class="title-container ${this.centered ? 'centered' : ''}">
<h1>${this.pageTitle}</h1>
${this.pageSubtitle ? html`
<p>${this.pageSubtitle}</p>
` : ''}
</div>
`;
}
}