mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Fix horizontal stack margin (#19700)
This commit is contained in:
parent
6e62f568fc
commit
c738127c09
@ -29,26 +29,25 @@ 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 var(--stack-card-side-margin))
|
var(--stack-card-margin, 0 4px)
|
||||||
);
|
);
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
#root > *:first-child {
|
#root[dir="ltr"] > *:first-child {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
margin-inline-start: 0;
|
|
||||||
margin-inline-end: var(--stack-card-side-margin);
|
|
||||||
}
|
}
|
||||||
#root > *:last-child {
|
#root[dir="ltr"] > *:last-child {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
margin-inline-end: 0;
|
}
|
||||||
margin-inline-start: var(--stack-card-side-margin);
|
#root[dir="rtl"] > *:first-child {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
#root[dir="rtl"] > *:last-child {
|
||||||
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
];
|
];
|
||||||
|
@ -12,6 +12,7 @@ import { HomeAssistant } from "../../../types";
|
|||||||
import { createCardElement } from "../create-element/create-card-element";
|
import { createCardElement } from "../create-element/create-card-element";
|
||||||
import { LovelaceCard, LovelaceCardEditor } from "../types";
|
import { LovelaceCard, LovelaceCardEditor } from "../types";
|
||||||
import { StackCardConfig } from "./types";
|
import { StackCardConfig } from "./types";
|
||||||
|
import { computeRTLDirection } from "../../../common/util/compute_rtl";
|
||||||
|
|
||||||
export abstract class HuiStackCard<T extends StackCardConfig = StackCardConfig>
|
export abstract class HuiStackCard<T extends StackCardConfig = StackCardConfig>
|
||||||
extends LitElement
|
extends LitElement
|
||||||
@ -77,7 +78,9 @@ export abstract class HuiStackCard<T extends StackCardConfig = StackCardConfig>
|
|||||||
${this._config.title
|
${this._config.title
|
||||||
? html`<h1 class="card-header">${this._config.title}</h1>`
|
? html`<h1 class="card-header">${this._config.title}</h1>`
|
||||||
: ""}
|
: ""}
|
||||||
<div id="root">${this._cards}</div>
|
<div id="root" dir=${this.hass ? computeRTLDirection(this.hass) : "ltr"}>
|
||||||
|
${this._cards}
|
||||||
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user