mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-15 22:10:20 +00:00
51 lines
1.0 KiB
TypeScript
51 lines
1.0 KiB
TypeScript
import { mdiLightbulbOutline } from "@mdi/js";
|
|
import { css, html, LitElement, nothing } from "lit";
|
|
import { customElement, property } from "lit/decorators";
|
|
import type { HomeAssistant } from "../types";
|
|
|
|
import "./ha-svg-icon";
|
|
|
|
@customElement("ha-tip")
|
|
class HaTip extends LitElement {
|
|
@property({ attribute: false }) public hass!: HomeAssistant;
|
|
|
|
public render() {
|
|
if (!this.hass) {
|
|
return nothing;
|
|
}
|
|
|
|
return html`
|
|
<ha-svg-icon .path=${mdiLightbulbOutline}></ha-svg-icon>
|
|
<span class="prefix"
|
|
>${this.hass.localize("ui.panel.config.tips.tip")}</span
|
|
>
|
|
<span class="text"><slot></slot></span>
|
|
`;
|
|
}
|
|
|
|
static styles = css`
|
|
:host {
|
|
display: block;
|
|
text-align: center;
|
|
}
|
|
|
|
.text {
|
|
direction: var(--direction);
|
|
margin-left: 2px;
|
|
margin-inline-start: 2px;
|
|
margin-inline-end: initial;
|
|
color: var(--secondary-text-color);
|
|
}
|
|
|
|
.prefix {
|
|
font-weight: 500;
|
|
}
|
|
`;
|
|
}
|
|
|
|
declare global {
|
|
interface HTMLElementTagNameMap {
|
|
"ha-tip": HaTip;
|
|
}
|
|
}
|