Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Table): enhance borders #1753

Merged
merged 1 commit into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,13 @@ exports[`Table scss have to match default theme snapshot 1`] = `
font-size: var(--font-size-small);
line-height: var(--line-height-small); }

.dnb-table:not(.dnb-table--border):not(.dnb-table--outline) > tbody
> tr:last-of-type
> td::after,
.dnb-table:not(.dnb-table--border):not(.dnb-table--outline) > tbody
> .dnb-table__tr:last-of-type > .dnb-table__td::after {
.dnb-table > tbody > .dnb-table__tr:last-of-type > .dnb-table__td::after {
content: '';
position: absolute;
left: 0;
right: 0;
bottom: -0.0625rem;
height: 0.0625rem;
background-color: var(--color-black-8); }
bottom: 0;
border-bottom: var(--outline); }
"
`;

Expand Down Expand Up @@ -158,74 +153,71 @@ exports[`Table scss have to match snapshot 1`] = `
.dnb-table {
--border: 0.0625rem solid var(--color-black-8);
--outline: 0.0625rem solid var(--color-black-8); }
.dnb-table--border tbody .dnb-table__td {
z-index: 2; }
.dnb-table--border tbody .dnb-table__td::after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: -1;
pointer-events: none;
border: var(--border);
border-right: none;
border-bottom: none; }
.dnb-table--border tbody .dnb-table__td:first-of-type::after {
border-left: none; }
.dnb-table--border tbody .dnb-table__td::after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1;
pointer-events: none;
border: var(--border);
border-right: none;
border-bottom: none; }
.dnb-table--border tbody .dnb-table__td:first-of-type::after {
border-left: none; }
.dnb-table:not(.dnb-table--outline) tbody .dnb-table__tr:last-of-type .dnb-table__td::after {
border-bottom: var(--border); }
.dnb-table--outline thead .dnb-table__th {
z-index: 2; }
.dnb-table--outline thead .dnb-table__th::after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: -1;
pointer-events: none;
border-top: var(--outline); }
.dnb-table--outline thead .dnb-table__th:first-of-type::after {
border-left: var(--outline); }
.dnb-table--outline thead .dnb-table__th:last-of-type::after {
border-right: var(--outline); }
.dnb-table--outline thead .dnb-table__th::after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1;
pointer-events: none;
border-top: var(--outline); }
.dnb-table--outline thead .dnb-table__th:first-of-type::after {
border-left: var(--outline); }
.dnb-table--outline thead .dnb-table__th:last-of-type::after {
border-right: var(--outline); }
.dnb-table--outline tbody .dnb-table__td {
z-index: 2; }
/* stylelint-disable */
/* stylelint-enable */ }
.dnb-table--outline tbody .dnb-table__td:first-of-type::after, .dnb-table--outline tbody .dnb-table__td:last-of-type::after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: -1;
z-index: 1;
pointer-events: none; }
.dnb-table--outline tbody .dnb-table__td:first-of-type::after {
border-left: var(--outline); }
.dnb-table--outline tbody .dnb-table__td:last-of-type::after {
border-right: var(--outline); }
.dnb-table--outline tbody .dnb-table__tr:last-of-type .dnb-table__td {
z-index: 2; }
.dnb-table--outline tbody .dnb-table__tr:last-of-type .dnb-table__td::after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: -1;
pointer-events: none;
border-bottom: var(--outline); }
.dnb-table--outline tbody .dnb-table__td, .dnb-table--outline tbody .dnb-table__td::before, .dnb-table--outline tbody .dnb-table__td::after {
transition: border-radius 400ms var(--easing-default); }
.dnb-table--outline tbody .dnb-table__tr:last-of-type .dnb-table__td::after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1;
pointer-events: none;
border-bottom: var(--outline); }
.dnb-table--outline thead .dnb-table__th:first-of-type, .dnb-table--outline thead .dnb-table__th:first-of-type::after {
border-radius: 0.5rem 0 0 0; }
.dnb-table--outline thead .dnb-table__th:last-of-type, .dnb-table--outline thead .dnb-table__th:last-of-type::after {
border-radius: 0 0.5rem 0 0; }
.dnb-table--outline tbody .dnb-table__tr:last-of-type .dnb-table__td:first-of-type, .dnb-table--outline tbody .dnb-table__tr:last-of-type .dnb-table__td:first-of-type::after {
.dnb-table--outline tbody .dnb-table__tr:last-of-type .dnb-table__td:first-of-type, .dnb-table--outline tbody .dnb-table__tr:last-of-type .dnb-table__td:first-of-type::before, .dnb-table--outline tbody .dnb-table__tr:last-of-type .dnb-table__td:first-of-type::after {
border-radius: 0 0 0 0.5rem; }
.dnb-table--outline tbody .dnb-table__tr:last-of-type .dnb-table__td:last-of-type, .dnb-table--outline tbody .dnb-table__tr:last-of-type .dnb-table__td:last-of-type::after {
.dnb-table--outline tbody .dnb-table__tr:last-of-type .dnb-table__td:last-of-type, .dnb-table--outline tbody .dnb-table__tr:last-of-type .dnb-table__td:last-of-type::before, .dnb-table--outline tbody .dnb-table__tr:last-of-type .dnb-table__td:last-of-type::after {
border-radius: 0 0 0.5rem 0; }
.dnb-table__td--no-spacing,
.dnb-table td.dnb-table__td--no-spacing {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,6 @@
*
*/

@mixin tableBorder {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1;

pointer-events: none;
}

.dnb-table__container {
position: relative;

Expand Down
30 changes: 10 additions & 20 deletions packages/dnb-eufemia/src/components/table/style/_table-td.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,10 @@

@import './_table-header-buttons.scss';

@mixin tableBorder {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: -1;

pointer-events: none;
}

.dnb-table {
// table border
--border: 0.0625rem solid var(--color-black-8);
&--border tbody &__td {
z-index: 2; // ensure border is behind content

&::after {
@include tableBorder();

Expand All @@ -42,8 +28,6 @@
// table outline
--outline: 0.0625rem solid var(--color-black-8);
&--outline thead &__th {
z-index: 2; // ensure border is behind content

&::after {
@include tableBorder();

Expand All @@ -58,8 +42,6 @@
}
}
&--outline tbody &__td {
z-index: 2; // ensure border is behind content

&:first-of-type::after,
&:last-of-type::after {
@include tableBorder();
Expand All @@ -71,10 +53,16 @@
&:last-of-type::after {
border-right: var(--outline);
}

/* stylelint-disable */
&,
&::before,
&::after {
transition: border-radius 400ms var(--easing-default);
}
/* stylelint-enable */
}
&--outline tbody &__tr:last-of-type &__td {
z-index: 2; // ensure border is behind content

&::after {
@include tableBorder();

Expand All @@ -95,12 +83,14 @@
}
&--outline tbody &__tr:last-of-type &__td:first-of-type {
&,
&::before,
&::after {
border-radius: 0 0 0 0.5rem;
}
}
&--outline tbody &__tr:last-of-type &__td:last-of-type {
&,
&::before,
&::after {
border-radius: 0 0 0.5rem 0;
}
Expand Down
12 changes: 12 additions & 0 deletions packages/dnb-eufemia/src/components/table/style/_table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
*
*/

@mixin tableBorder {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1;

pointer-events: none;
}

@import './_table-header-buttons.scss';
@import './_table-th.scss';
@import './_table-td.scss';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,13 @@
// &:not(#{&}--border):not(#{&}--outline) > thead > &__tr > &__th::after,

// border
&:not(#{&}--border):not(#{&}--outline)
> tbody
> tr:last-of-type
> td::after,
&:not(#{&}--border):not(#{&}--outline)
> tbody
> &__tr:last-of-type
> &__td::after {
& > tbody > &__tr:last-of-type > &__td::after {
content: '';
position: absolute;
left: 0;
right: 0;
bottom: -0.0625rem;
bottom: 0; // don't use negative value, else it will be hidden when accordion

height: 0.0625rem;
background-color: var(--color-black-8);
border-bottom: var(--outline);
}
}