RTL stack card fix (#19394)

This commit is contained in:
Yosi Levy 2024-01-15 14:55:11 +02:00 committed by GitHub
parent 6256192c0c
commit 7e93367394
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 9 deletions

View File

@ -29,19 +29,26 @@ export class HuiHorizontalStackCard extends HuiStackCard {
display: flex; display: flex;
height: 100%; height: 100%;
} }
#root {
--stack-card-side-margin: 4px;
}
#root > * { #root > * {
flex: 1 1 0; flex: 1 1 0;
margin: var( margin: var(
--horizontal-stack-card-margin, --horizontal-stack-card-margin,
var(--stack-card-margin, 0 4px) var(--stack-card-margin, 0 var(--stack-card-side-margin))
); );
min-width: 0; min-width: 0;
} }
#root > *:first-child { #root > *:first-child {
margin-left: 0; margin-left: 0;
margin-inline-start: 0;
margin-inline-end: var(--stack-card-side-margin);
} }
#root > *:last-child { #root > *:last-child {
margin-right: 0; margin-right: 0;
margin-inline-end: 0;
margin-inline-start: var(--stack-card-side-margin);
} }
`, `,
]; ];

View File

@ -1,6 +1,4 @@
import { import {
mdiArrowLeft,
mdiArrowRight,
mdiCodeBraces, mdiCodeBraces,
mdiContentCopy, mdiContentCopy,
mdiContentCut, mdiContentCut,
@ -25,6 +23,8 @@ import {
import { storage } from "../../../../common/decorators/storage"; import { storage } from "../../../../common/decorators/storage";
import { HASSDomEvent, fireEvent } from "../../../../common/dom/fire_event"; import { HASSDomEvent, fireEvent } from "../../../../common/dom/fire_event";
import "../../../../components/ha-icon-button"; import "../../../../components/ha-icon-button";
import "../../../../components/ha-icon-button-arrow-prev";
import "../../../../components/ha-icon-button-arrow-next";
import type { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; import type { LovelaceCardConfig } from "../../../../data/lovelace/config/card";
import type { LovelaceConfig } from "../../../../data/lovelace/config/types"; import type { LovelaceConfig } from "../../../../data/lovelace/config/types";
import { HomeAssistant } from "../../../../types"; import { HomeAssistant } from "../../../../types";
@ -131,25 +131,23 @@ export class HuiStackCardEditor
.path=${isGuiMode ? mdiCodeBraces : mdiListBoxOutline} .path=${isGuiMode ? mdiCodeBraces : mdiListBoxOutline}
></ha-icon-button> ></ha-icon-button>
<ha-icon-button <ha-icon-button-arrow-prev
.disabled=${selected === 0} .disabled=${selected === 0}
.label=${this.hass!.localize( .label=${this.hass!.localize(
"ui.panel.lovelace.editor.edit_card.move_before" "ui.panel.lovelace.editor.edit_card.move_before"
)} )}
.path=${mdiArrowLeft}
@click=${this._handleMove} @click=${this._handleMove}
.move=${-1} .move=${-1}
></ha-icon-button> ></ha-icon-button-arrow-prev>
<ha-icon-button <ha-icon-button-arrow-next
.label=${this.hass!.localize( .label=${this.hass!.localize(
"ui.panel.lovelace.editor.edit_card.move_after" "ui.panel.lovelace.editor.edit_card.move_after"
)} )}
.path=${mdiArrowRight}
.disabled=${selected === numcards - 1} .disabled=${selected === numcards - 1}
@click=${this._handleMove} @click=${this._handleMove}
.move=${1} .move=${1}
></ha-icon-button> ></ha-icon-button-arrow-next>
<ha-icon-button <ha-icon-button
.label=${this.hass!.localize( .label=${this.hass!.localize(