Skip to content

Commit

Permalink
Fixes border radius on top corners of Table component (#2143)
Browse files Browse the repository at this point in the history
Also removes `border-radius: inherit` from the `Table` component.
  • Loading branch information
Ben-Pusey-Bentley authored Jul 23, 2024
1 parent e4b624b commit 88e2826
Show file tree
Hide file tree
Showing 24 changed files with 30 additions and 20 deletions.
5 changes: 5 additions & 0 deletions .changeset/brave-pants-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@itwin/itwinui-react': patch
---

Added `border-radius` to the `Table` component so that the border radius is correctly applied to the `Table`'s corners.
5 changes: 5 additions & 0 deletions .changeset/itchy-pigs-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@itwin/itwinui-css': patch
---

Added `border-radius` to the `.iui-table` class so that the border radius is correctly applied to the table's corners.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 19 additions & 12 deletions packages/itwinui-css/src/table/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
overflow: auto;
scrollbar-gutter: stable;
background-color: var(--iui-color-background);
border-radius: var(--iui-border-radius-1);

@include iui-table-cell-icon;

Expand All @@ -28,8 +29,6 @@

display: flex;
flex-shrink: 0;
border-start-start-radius: var(--iui-border-radius-1);
border-start-end-radius: var(--iui-border-radius-1);
}

@mixin iui-table-header {
Expand Down Expand Up @@ -153,10 +152,6 @@
min-inline-size: 100%;
display: flex;

&:last-of-type {
border-radius: inherit;
}

.iui-table-header & {
flex-grow: 1;
}
Expand Down Expand Up @@ -308,6 +303,13 @@
}
// #endregion Statuses & states
}

.iui-table-body:not(:has(+ .iui-table-paginator)) & {
&:last-of-type {
border-end-start-radius: var(--iui-border-radius-1);
border-end-end-radius: var(--iui-border-radius-1);
}
}
}

// For content placed after the table body and before the paginator
Expand Down Expand Up @@ -360,11 +362,6 @@
}
}

&:last-child {
border-end-start-radius: var(--iui-border-radius-1);
border-end-end-radius: var(--iui-border-radius-1);
}

&.iui-zebra-striping .iui-table-row:nth-child(even):not([aria-selected='true']) .iui-table-cell {
background-color: var(--iui-color-background-zebra);
}
Expand Down Expand Up @@ -397,9 +394,19 @@
position: relative;
word-break: break-word;

//Adds the border-radius only to the first and last cells in the last row when the table has no paginator.
.iui-table-body:not(:has(+ .iui-table-paginator)) > .iui-table-row:last-of-type & {
&:first-of-type {
border-end-start-radius: var(--iui-border-radius-1);
}

&:last-of-type {
border-end-end-radius: var(--iui-border-radius-1);
}
}

&:first-of-type {
border-inline-start: solid 1px transparent;
border-end-start-radius: inherit;
}

&:last-of-type {
Expand Down
9 changes: 1 addition & 8 deletions packages/itwinui-react/src/core/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1152,14 +1152,7 @@ export const Table = <
(isSelectable && selectionMode === 'multi') || undefined
}
>
<ShadowRoot
css={`
div,
slot {
border-radius: inherit;
}
`}
>
<ShadowRoot>
{enableVirtualization ? (
<div
style={{
Expand Down

0 comments on commit 88e2826

Please sign in to comment.