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/Label.ts
dependabot[bot] 73733b20b6
build(deps): bump @trivago/prettier-plugin-sort-imports from 2.0.4 to 3.0.0 in /web (#1684)
* build(deps): bump @trivago/prettier-plugin-sort-imports in /web

Bumps [@trivago/prettier-plugin-sort-imports](https://github.com/trivago/prettier-plugin-sort-imports) from 2.0.4 to 3.0.0.
- [Release notes](https://github.com/trivago/prettier-plugin-sort-imports/releases)
- [Changelog](https://github.com/trivago/prettier-plugin-sort-imports/blob/master/CHANGELOG.md)
- [Commits](https://github.com/trivago/prettier-plugin-sort-imports/commits)

---
updated-dependencies:
- dependency-name: "@trivago/prettier-plugin-sort-imports"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* web: update prettier config

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jens Langhammer <jens.langhammer@beryju.org>
2021-10-28 09:48:51 +02:00

60 lines
1.6 KiB
TypeScript

import { CSSResult, LitElement, TemplateResult, html } from "lit";
import { customElement, property } from "lit/decorators";
import AKGlobal from "../authentik.css";
import PFLabel from "@patternfly/patternfly/components/Label/label.css";
import PFBase from "@patternfly/patternfly/patternfly-base.css";
export enum PFColor {
Green = "pf-m-green",
Orange = "pf-m-orange",
Red = "pf-m-red",
Grey = "",
}
@customElement("ak-label")
export class Label extends LitElement {
@property()
color: PFColor = PFColor.Grey;
@property()
icon?: string;
@property()
text?: string;
static get styles(): CSSResult[] {
return [PFBase, PFLabel, AKGlobal];
}
getDefaultIcon(): string {
switch (this.color) {
case PFColor.Green:
return "fa-check";
case PFColor.Orange:
return "fa-exclamation-triangle";
case PFColor.Red:
return "fa-times";
case PFColor.Grey:
return "fa-question-circle";
default:
return "";
}
}
render(): TemplateResult {
return html`<span class="pf-c-label ${this.color}">
<span class="pf-c-label__content">
<span class="pf-c-label__icon">
<i
class="fas ${this.text ? "fa-fw" : ""} ${this.icon ||
this.getDefaultIcon()}"
aria-hidden="true"
></i>
</span>
${this.text || ""}
</span>
</span>`;
}
}