2025-06-29 19:55:58 +00:00
|
|
|
import { DeesElement, property, html, customElement, type TemplateResult, css, cssManager, unsafeCSS } from '@design.estate/dees-element';
|
2024-06-26 20:28:09 +02:00
|
|
|
import * as domtools from '@design.estate/dees-domtools';
|
2025-06-29 19:55:58 +00:00
|
|
|
import { fonts } from '../styles/shared.styles.js';
|
|
|
|
|
import { demoFunc } from './upl-statuspage-header.demo.js';
|
2021-09-23 14:30:02 +02:00
|
|
|
|
|
|
|
|
declare global {
|
|
|
|
|
interface HTMLElementTagNameMap {
|
|
|
|
|
'upl-statuspage-header': UplStatuspageHeader;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@customElement('upl-statuspage-header')
|
|
|
|
|
export class UplStatuspageHeader extends DeesElement {
|
2021-09-24 13:53:07 +02:00
|
|
|
// STATIC
|
2025-06-29 19:55:58 +00:00
|
|
|
public static demo = demoFunc;
|
2021-09-23 14:30:02 +02:00
|
|
|
|
2021-09-24 13:53:07 +02:00
|
|
|
// INSTANCE
|
2025-06-29 19:55:58 +00:00
|
|
|
@property({ type: String })
|
2021-09-24 13:53:07 +02:00
|
|
|
public pageTitle: string = "Statuspage Title";
|
2021-09-23 14:30:02 +02:00
|
|
|
|
2025-06-29 19:55:58 +00:00
|
|
|
@property({ type: Boolean })
|
|
|
|
|
public showReportButton: boolean = true;
|
|
|
|
|
|
|
|
|
|
@property({ type: Boolean })
|
|
|
|
|
public showSubscribeButton: boolean = true;
|
|
|
|
|
|
|
|
|
|
@property({ type: String })
|
|
|
|
|
public brandColor: string = '';
|
|
|
|
|
|
|
|
|
|
@property({ type: String })
|
|
|
|
|
public logoUrl: string = '';
|
|
|
|
|
|
|
|
|
|
@property({ type: Boolean })
|
|
|
|
|
public customStyles: boolean = false;
|
|
|
|
|
|
|
|
|
|
@property({ type: Boolean })
|
|
|
|
|
public loading: boolean = false;
|
|
|
|
|
|
2021-09-23 14:30:02 +02:00
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
|
super();
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-24 13:53:07 +02:00
|
|
|
public static styles = [
|
|
|
|
|
domtools.elementBasic.staticStyles,
|
|
|
|
|
css`
|
|
|
|
|
:host {
|
2021-09-23 14:30:02 +02:00
|
|
|
display: block;
|
2025-06-29 19:55:58 +00:00
|
|
|
background: ${cssManager.bdTheme('#ffffff', '#0a0a0a')};
|
|
|
|
|
font-family: ${unsafeCSS(fonts.base)};
|
|
|
|
|
color: ${cssManager.bdTheme('#0a0a0a', '#fafafa')};
|
|
|
|
|
border-bottom: 1px solid ${cssManager.bdTheme('#e5e7eb', '#262626')};
|
2021-09-23 14:30:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mainbox {
|
|
|
|
|
margin: auto;
|
2025-06-29 19:55:58 +00:00
|
|
|
max-width: 1200px;
|
|
|
|
|
padding: 0 24px;
|
2021-09-23 14:30:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mainbox .actions {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-end;
|
2025-06-29 19:55:58 +00:00
|
|
|
gap: 8px;
|
|
|
|
|
padding: 24px 0;
|
2021-09-23 14:30:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mainbox .actions .actionButton {
|
2025-06-29 19:55:58 +00:00
|
|
|
background: transparent;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
border: 1px solid ${cssManager.bdTheme('#e5e7eb', '#262626')};
|
|
|
|
|
padding: 8px 16px;
|
|
|
|
|
border-radius: 6px;
|
2021-09-23 14:30:02 +02:00
|
|
|
cursor: pointer;
|
|
|
|
|
user-select: none;
|
2025-06-29 19:55:58 +00:00
|
|
|
transition: all 0.2s ease;
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
min-height: 36px;
|
|
|
|
|
color: ${cssManager.bdTheme('#0a0a0a', '#fafafa')};
|
2021-09-23 14:30:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mainbox .actions .actionButton:hover {
|
2025-06-29 19:55:58 +00:00
|
|
|
background: ${cssManager.bdTheme('#f9fafb', '#262626')};
|
|
|
|
|
border-color: ${cssManager.bdTheme('#d1d5db', '#404040')};
|
|
|
|
|
transform: translateY(-1px);
|
2021-09-23 14:30:02 +02:00
|
|
|
}
|
|
|
|
|
|
2025-06-29 19:55:58 +00:00
|
|
|
.mainbox .actions .actionButton:active {
|
|
|
|
|
transform: translateY(0);
|
2021-09-23 14:30:02 +02:00
|
|
|
}
|
|
|
|
|
|
2025-06-29 19:55:58 +00:00
|
|
|
.header-content {
|
|
|
|
|
padding: 48px 0 64px 0;
|
2021-09-23 14:30:02 +02:00
|
|
|
text-align: center;
|
2025-06-29 19:55:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
h1 {
|
|
|
|
|
margin: 0;
|
|
|
|
|
font-size: 48px;
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
letter-spacing: -0.02em;
|
|
|
|
|
line-height: 1.1;
|
|
|
|
|
color: ${cssManager.bdTheme('#0a0a0a', '#fafafa')};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.subtitle {
|
|
|
|
|
margin: 16px 0 0 0;
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
color: ${cssManager.bdTheme('#6b7280', '#a1a1aa')};
|
|
|
|
|
letter-spacing: 0.02em;
|
|
|
|
|
text-transform: uppercase;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.logo {
|
|
|
|
|
display: block;
|
|
|
|
|
margin: 0 auto 32px;
|
|
|
|
|
max-width: 180px;
|
|
|
|
|
height: auto;
|
|
|
|
|
filter: ${cssManager.bdTheme('none', 'brightness(0) invert(1)')};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.loading-skeleton {
|
|
|
|
|
height: 200px;
|
|
|
|
|
background: ${cssManager.bdTheme(
|
|
|
|
|
'linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%)',
|
|
|
|
|
'linear-gradient(90deg, #1f1f1f 25%, #262626 50%, #1f1f1f 75%)'
|
|
|
|
|
)};
|
|
|
|
|
background-size: 200% 100%;
|
|
|
|
|
animation: loading 1.5s infinite;
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
margin: 24px 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@keyframes loading {
|
|
|
|
|
0% { background-position: 200% 0; }
|
|
|
|
|
100% { background-position: -200% 0; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Primary button variant */
|
|
|
|
|
.actionButton.primary {
|
|
|
|
|
background: ${cssManager.bdTheme('#0a0a0a', '#fafafa')};
|
|
|
|
|
color: ${cssManager.bdTheme('#ffffff', '#0a0a0a')};
|
|
|
|
|
border-color: ${cssManager.bdTheme('#0a0a0a', '#fafafa')};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.actionButton.primary:hover {
|
|
|
|
|
background: ${cssManager.bdTheme('#262626', '#f4f4f5')};
|
|
|
|
|
border-color: ${cssManager.bdTheme('#262626', '#f4f4f5')};
|
2021-09-23 14:30:02 +02:00
|
|
|
}
|
2021-09-24 13:53:07 +02:00
|
|
|
`
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
public render(): TemplateResult {
|
2025-06-29 19:55:58 +00:00
|
|
|
if (this.loading) {
|
|
|
|
|
return html`
|
|
|
|
|
<div class="mainbox">
|
|
|
|
|
<div class="loading-skeleton"></div>
|
|
|
|
|
</div>
|
|
|
|
|
`;
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-24 13:53:07 +02:00
|
|
|
return html`
|
|
|
|
|
${domtools.elementBasic.styles}
|
|
|
|
|
<style>
|
2025-06-29 19:55:58 +00:00
|
|
|
${this.customStyles && this.brandColor ? `
|
|
|
|
|
.mainbox .actions .actionButton {
|
|
|
|
|
border-color: ${this.brandColor};
|
|
|
|
|
color: ${this.brandColor};
|
|
|
|
|
}
|
|
|
|
|
.mainbox .actions .actionButton:hover {
|
|
|
|
|
background: ${this.brandColor}10;
|
|
|
|
|
border-color: ${this.brandColor};
|
|
|
|
|
}
|
|
|
|
|
.mainbox .actions .actionButton.primary {
|
|
|
|
|
background: ${this.brandColor};
|
|
|
|
|
border-color: ${this.brandColor};
|
|
|
|
|
color: white;
|
|
|
|
|
}
|
|
|
|
|
.mainbox .actions .actionButton.primary:hover {
|
|
|
|
|
background: ${this.brandColor}dd;
|
|
|
|
|
border-color: ${this.brandColor}dd;
|
|
|
|
|
}
|
|
|
|
|
` : ''}
|
2021-09-23 14:30:02 +02:00
|
|
|
</style>
|
|
|
|
|
<div class="mainbox">
|
|
|
|
|
<div class="actions">
|
2025-06-29 19:55:58 +00:00
|
|
|
${this.showReportButton ? html`
|
|
|
|
|
<div class="actionButton" @click=${this.dispatchReportNewIncident}>Report Issue</div>
|
|
|
|
|
` : ''}
|
|
|
|
|
${this.showSubscribeButton ? html`
|
|
|
|
|
<div class="actionButton primary" @click=${this.dispatchStatusSubscribe}>Subscribe</div>
|
|
|
|
|
` : ''}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="header-content">
|
|
|
|
|
${this.logoUrl ? html`
|
|
|
|
|
<img src="${this.logoUrl}" alt="Logo" class="logo">
|
|
|
|
|
` : ''}
|
|
|
|
|
<h1>${this.pageTitle}</h1>
|
|
|
|
|
<div class="subtitle">System Status</div>
|
2021-09-23 14:30:02 +02:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
`;
|
|
|
|
|
}
|
2021-09-24 13:53:07 +02:00
|
|
|
|
|
|
|
|
public dispatchReportNewIncident() {
|
|
|
|
|
this.dispatchEvent(new CustomEvent('reportNewIncident', {
|
|
|
|
|
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public dispatchStatusSubscribe() {
|
|
|
|
|
this.dispatchEvent(new CustomEvent('statusSubscribe', {
|
|
|
|
|
|
|
|
|
|
}))
|
|
|
|
|
}
|
2021-09-23 14:30:02 +02:00
|
|
|
}
|