Skip to content

Commit

Permalink
Use padding for vertical layout spacing
Browse files Browse the repository at this point in the history
Some adjustments
  • Loading branch information
piitaya committed Feb 29, 2024
1 parent b63bf93 commit e08d338
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ All column based layouts accept the following `layout` options:
| `max_cols` | number | Maximum number of columns to show | 4 if sidebar is hidden <br> 3 if sidebar is shown |
| `rtl` | `true`/`false` | Place columns in right-to-left order | `false` |
| `column_widths` | special | A [`grid-template-columns`](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns) specification of column widths | `none` |
| `margin` | string | A CSS margin applied to the layout itself | `4px 4px 0px 4px` |
| `padding` | string | A CSS padding applied to the layout itself | `0px` |
| `margin` | string | A CSS margin applied to the layout itself | `0px 4px 0px 4px` |
| `padding` | string | A CSS padding applied to the layout itself | `4px 0px 4px 0px` |
| `height` | string | A CSS height applied to the layout itself | `auto` |
| `card_margin` | string | CSS margin applied to each card in the layout | `var(--masonry-view-card-margin, 4px 4px 8px)` |
| `reflow` | `true`/`false` | If `true` the layout will get reorganized when cards are hidden (e.g. with conditional or entity-filter cards). May cause performance issues. | `false` |
Expand Down
2 changes: 1 addition & 1 deletion layout-card.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/layouts/base-column-layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ export class BaseColumnLayout extends BaseLayout {
--column-max-width: ${column_max_width}px;
--column-width: ${column_width}px;
--column-widths: ${this._config.layout?.column_widths ?? "none"};
--layout-margin: ${this._config.layout?.margin ?? "4px 4px 0px 4px"};
--layout-padding: ${this._config.layout?.padding ?? "0px"};
--layout-margin: ${this._config.layout?.margin ?? "0px 4px 0px 4px"};
--layout-padding: ${this._config.layout?.padding ?? "4px 0px 4px 0px"};
--card-margin: ${
this._config.layout?.card_margin ??
"var(--masonry-view-card-margin, 4px 4px 8px)"
Expand Down
3 changes: 1 addition & 2 deletions src/layouts/base-layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ export class BaseLayout extends LitElement {
static get _fab_styles() {
return css`
ha-fab {
position: sticky;
float: right;
position: fixed;
right: calc(16px + env(safe-area-inset-right));
bottom: calc(16px + env(safe-area-inset-bottom));
z-index: 1;
Expand Down
4 changes: 2 additions & 2 deletions src/layouts/grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class GridLayout extends BaseLayout {
const styleEl = document.createElement("style");
styleEl.innerHTML = `
:host {
--layout-margin: ${this._config.layout?.margin ?? "4px 4px 0px 4px"};
--layout-padding: ${this._config.layout?.padding ?? "0px"};
--layout-margin: ${this._config.layout?.margin ?? "0px 4px 0px 4px"};
--layout-padding: ${this._config.layout?.padding ?? "4px 0px 4px 0px"};
--layout-height: ${this._config.layout?.height ?? "auto"};
--layout-overflow: ${
this._config.layout?.height !== undefined ? "auto" : "visible"
Expand Down

0 comments on commit e08d338

Please sign in to comment.