This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/web/src/elements/cards/AggregateCard.ts

49 lines
1.4 KiB
TypeScript
Raw Normal View History

2020-12-01 21:17:07 +00:00
import { gettext } from "django";
import { css, CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element";
import { COMMON_STYLES } from "../../common/styles";
@customElement("pb-aggregate-card")
export class AggregateCard extends LitElement {
@property()
icon?: string;
@property()
header?: string;
@property()
headerLink?: string;
static get styles(): CSSResult[] {
return COMMON_STYLES.concat([css`
.center-value {
font-size: var(--pf-global--icon--FontSize--lg);
text-align: center;
}
.subtext {
font-size: var(--pf-global--FontSize--sm);
}
`]);
}
renderInner(): TemplateResult {
return html`<slot></slot>`;
}
render(): TemplateResult {
return html`<div class="pf-c-card pf-c-card-aggregate">
<div class="pf-c-card__header pf-l-flex pf-m-justify-content-space-between">
<div class="pf-c-card__header-main">
<i class="${this.icon}"></i> ${this.header ? gettext(this.header) : ""}
</div>
${this.headerLink ? html`<a href="${this.headerLink}">
<i class="fa fa-external-link-alt"> </i>
</a>` : ""}
</div>
<div class="pf-c-card__body center-value">
${this.renderInner()}
</div>
</div>`;
}
}