Skip to content

Commit

Permalink
feat: add custom CSS property to configure cell padding (#6646)
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan authored Oct 13, 2023
1 parent 873d5c5 commit b6dbb7b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 4 additions & 5 deletions packages/grid/theme/lumo/vaadin-grid-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ registerStyles(
[part~='cell'] {
min-height: var(--lumo-size-m);
background-color: var(--lumo-base-color);
--_cell-padding: var(--vaadin-grid-cell-padding, var(--_cell-default-padding));
--_cell-default-padding: var(--lumo-space-xs) var(--lumo-space-m);
}
[part~='cell'] ::slotted(vaadin-grid-cell-content) {
cursor: default;
padding: var(--lumo-space-xs) var(--lumo-space-m);
padding: var(--_cell-padding);
}
/* Apply row borders by default and introduce the "no-row-borders" variant */
Expand Down Expand Up @@ -331,16 +333,13 @@ registerStyles(
:host([theme~='compact']) [part~='cell'] {
min-height: var(--lumo-size-s);
--_cell-default-padding: var(--lumo-space-xs) var(--lumo-space-s);
}
:host([theme~='compact']) [part~='first-row'] [part~='cell']:not([part~='details-cell']) {
min-height: calc(var(--lumo-size-s) - var(--_lumo-grid-border-width));
}
:host([theme~='compact']) [part~='cell'] ::slotted(vaadin-grid-cell-content) {
padding: var(--lumo-space-xs) var(--lumo-space-s);
}
/* Wrap cell contents */
:host([theme~='wrap-cell-content']) [part~='cell'] ::slotted(vaadin-grid-cell-content) {
Expand Down
8 changes: 5 additions & 3 deletions packages/grid/theme/material/vaadin-grid-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ registerStyles(
[part~='cell'] {
min-height: 48px;
-webkit-tap-highlight-color: transparent;
--_cell-padding: var(--vaadin-grid-cell-padding, var(--_cell-default-padding));
--_cell-default-padding: 8px 16px;
}
[part~='cell'] ::slotted(vaadin-grid-cell-content) {
padding: 8px 16px;
padding: var(--_cell-padding);
}
[part~='details-cell'] ::slotted(vaadin-grid-cell-content) {
padding: 14px 16px;
[part~='details-cell'] {
--_cell-default-padding: 14px 16px;
}
[part~='header-cell'],
Expand Down

0 comments on commit b6dbb7b

Please sign in to comment.