mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 11:16:35 +00:00
Make the "icon next/prev" series load faster (#18087)
This commit is contained in:
parent
c25447d001
commit
242b018ece
@ -12,19 +12,8 @@ export class HaIconButtonArrowNext extends LitElement {
|
|||||||
|
|
||||||
@property() public label?: string;
|
@property() public label?: string;
|
||||||
|
|
||||||
@state() private _icon = mdiArrowRight;
|
@state() private _icon =
|
||||||
|
document.dir === "ltr" ? mdiArrowRight : mdiArrowLeft;
|
||||||
public connectedCallback() {
|
|
||||||
super.connectedCallback();
|
|
||||||
|
|
||||||
// wait to check for direction since otherwise direction is wrong even though top level is RTL
|
|
||||||
setTimeout(() => {
|
|
||||||
this._icon =
|
|
||||||
window.getComputedStyle(this).direction === "ltr"
|
|
||||||
? mdiArrowRight
|
|
||||||
: mdiArrowLeft;
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
|
@ -12,19 +12,8 @@ export class HaIconButtonArrowPrev extends LitElement {
|
|||||||
|
|
||||||
@property() public label?: string;
|
@property() public label?: string;
|
||||||
|
|
||||||
@state() private _icon = mdiArrowLeft;
|
@state() private _icon =
|
||||||
|
document.dir === "ltr" ? mdiArrowLeft : mdiArrowRight;
|
||||||
public connectedCallback() {
|
|
||||||
super.connectedCallback();
|
|
||||||
|
|
||||||
// wait to check for direction since otherwise direction is wrong even though top level is RTL
|
|
||||||
setTimeout(() => {
|
|
||||||
this._icon =
|
|
||||||
window.getComputedStyle(this).direction === "ltr"
|
|
||||||
? mdiArrowLeft
|
|
||||||
: mdiArrowRight;
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
|
@ -12,19 +12,8 @@ export class HaIconButtonNext extends LitElement {
|
|||||||
|
|
||||||
@property() public label?: string;
|
@property() public label?: string;
|
||||||
|
|
||||||
@state() private _icon = mdiChevronRight;
|
@state() private _icon =
|
||||||
|
document.dir === "ltr" ? mdiChevronRight : mdiChevronLeft;
|
||||||
public connectedCallback() {
|
|
||||||
super.connectedCallback();
|
|
||||||
|
|
||||||
// wait to check for direction since otherwise direction is wrong even though top level is RTL
|
|
||||||
setTimeout(() => {
|
|
||||||
this._icon =
|
|
||||||
window.getComputedStyle(this).direction === "ltr"
|
|
||||||
? mdiChevronRight
|
|
||||||
: mdiChevronLeft;
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
|
@ -12,19 +12,8 @@ export class HaIconButtonPrev extends LitElement {
|
|||||||
|
|
||||||
@property() public label?: string;
|
@property() public label?: string;
|
||||||
|
|
||||||
@state() private _icon = mdiChevronLeft;
|
@state() private _icon =
|
||||||
|
document.dir === "ltr" ? mdiChevronLeft : mdiChevronRight;
|
||||||
public connectedCallback() {
|
|
||||||
super.connectedCallback();
|
|
||||||
|
|
||||||
// wait to check for direction since otherwise direction is wrong even though top level is RTL
|
|
||||||
setTimeout(() => {
|
|
||||||
this._icon =
|
|
||||||
window.getComputedStyle(this).direction === "ltr"
|
|
||||||
? mdiChevronLeft
|
|
||||||
: mdiChevronRight;
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
|
@ -4,17 +4,7 @@ import { HaSvgIcon } from "./ha-svg-icon";
|
|||||||
|
|
||||||
@customElement("ha-icon-next")
|
@customElement("ha-icon-next")
|
||||||
export class HaIconNext extends HaSvgIcon {
|
export class HaIconNext extends HaSvgIcon {
|
||||||
public connectedCallback() {
|
path = document.dir === "ltr" ? mdiChevronRight : mdiChevronLeft;
|
||||||
super.connectedCallback();
|
|
||||||
|
|
||||||
// wait to check for direction since otherwise direction is wrong even though top level is RTL
|
|
||||||
setTimeout(() => {
|
|
||||||
this.path =
|
|
||||||
window.getComputedStyle(this).direction === "ltr"
|
|
||||||
? mdiChevronRight
|
|
||||||
: mdiChevronLeft;
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
@ -4,17 +4,7 @@ import { HaSvgIcon } from "./ha-svg-icon";
|
|||||||
|
|
||||||
@customElement("ha-icon-prev")
|
@customElement("ha-icon-prev")
|
||||||
export class HaIconPrev extends HaSvgIcon {
|
export class HaIconPrev extends HaSvgIcon {
|
||||||
public connectedCallback() {
|
path = document.dir === "ltr" ? mdiChevronLeft : mdiChevronRight;
|
||||||
super.connectedCallback();
|
|
||||||
|
|
||||||
// wait to check for direction since otherwise direction is wrong even though top level is RTL
|
|
||||||
setTimeout(() => {
|
|
||||||
this.path =
|
|
||||||
window.getComputedStyle(this).direction === "ltr"
|
|
||||||
? mdiChevronLeft
|
|
||||||
: mdiChevronRight;
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user