// Mockup https://www.figma.com/design/zsq2ahat30acTnumyy9aqC/00.Small-System?node-id=504-31645&m=dev
import { LitElement, css, html, nothing, unsafeCSS } from "lit";
import { customElement, property } from "lit/decorators.js";
import { classMap } from "lit/directives/class-map.js";
import { ifDefined } from "lit/directives/if-defined.js";
import TemsCardCatalogStyle from "@styles/cards/tems-card-catalog.scss?inline";
import "~icons/material-symbols/rss-feed-rounded";
import "~icons/ic/outline-place";
import "@components/buttons/tems-button";
export type TemsCardCatalogProps = {
cardType?: string;
isFullSize: boolean;
logoOnTop: boolean;
backgroundImg?: string;
orgLogo?: string;
address?: string;
language?: string;
date?: string;
source?: string;
header?: string;
content?: string;
badge?: string;
tags: string[] | { name: string; type?: string }[];
};
@customElement("tems-card-catalog")
export class TemsCardCatalog extends LitElement {
static styles = css`
${unsafeCSS(TemsCardCatalogStyle)};
`;
@property({ attribute: "type", type: String, reflect: true })
cardType: TemsCardCatalogProps["cardType"] = "vertical";
@property({ attribute: "address", type: String })
address: TemsCardCatalogProps["address"];
@property({ attribute: "language", type: String })
language: TemsCardCatalogProps["language"];
@property({ attribute: "date", type: String })
date: TemsCardCatalogProps["date"];
@property({ attribute: "source", type: String })
source: TemsCardCatalogProps["source"];
@property({ attribute: "background-img", type: String })
backgroundImg: TemsCardCatalogProps["backgroundImg"];
@property({ attribute: "org-logo", type: String })
orgLogo: TemsCardCatalogProps["orgLogo"];
@property({ attribute: "display-logo", type: Boolean })
logoOnTop: TemsCardCatalogProps["logoOnTop"] = false;
@property({ attribute: "full-size", type: Boolean })
isFullSize: TemsCardCatalogProps["isFullSize"] = false;
@property({ attribute: "header", type: String })
header: TemsCardCatalogProps["header"];
@property({ attribute: "content", type: String })
content: TemsCardCatalogProps["content"];
@property({ attribute: "badge", type: String })
badge: TemsCardCatalogProps["badge"];
@property({ attribute: false })
tags: TemsCardCatalogProps["tags"] = [];
private _getType() {
const allowedTypes = ["vertical", "horizontal", "bill-image"];
if (!allowedTypes.includes(String(this.cardType))) {
this.cardType = "vertical";
}
return {
vertical: this.cardType === "vertical",
horizontal: this.cardType === "horizontal",
billImage: this.cardType === "bill-image",
};
}
private renderImageHeader() {
if (this.isFullSize && (this.backgroundImg || this.badge)) {
if (this.backgroundImg) {
return html`