dees-document/ts_web/elements/pageheader.ts
2023-10-16 18:28:12 +02:00

97 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 shared from './shared/index.js';
import * as tsclass from '@tsclass/tsclass';
declare global {
interface HTMLElementTagNameMap {
'dedocument-pageheader': DePageHeader;
}
}
@customElement('dedocument-pageheader')
export class DePageHeader extends DeesElement {
public static demo = () => html`
<dedocument-pageheader .format="${'a4'}"></dedocument-pageheader>
`;
@property({
type: Object,
})
public letterData: tsclass.business.ILetter = null;
@property({
type: Number,
})
public pageNumber: number = 1;
@property({
type: Number,
})
public pageTotalNumber: number = 1;
constructor() {
super();
domtools.DomTools.setupDomTools();
}
public static styles = [
domtools.elementBasic.staticStyles,
css`
:host {
color: #333;
}
.topstripe {
position: absolute;
overflow: hidden;
top: 0px;
left: 0px;
right: 0px;
height: 130px;
color: #333;
text-align: center;
border-bottom: 2px solid #00000020;
}
.topstripe2 {
position: absolute;
overflow: hidden;
top: 130px;
left: auto;
right: ${unsafeCSS(shared.rightMargin + 'px')};
height: 20px;
line-height: 20px;
color: #333;
font-size: 10px;
}
.topstripe img {
filter: invert(1);
position: absolute;
bottom: 10px;
height: 25px;
left: auto;
right: ${unsafeCSS(shared.rightMargin + 'px')};
}
`,
];
public render(): TemplateResult {
return html`
<div class="topstripe">
<img src="https://assetbroker.lossless.one/brandfiles/lossless/svg-minimal-bright.svg" />
</div>
<div class="topstripe2">${this.letterData?.from?.description || '[no letterData.from.description set]'}</div>
`;
}
}