Skip to content

Commit

Permalink
♻️ - refactor: refactor DataGrid components
Browse files Browse the repository at this point in the history
  • Loading branch information
svenvandescheur committed Aug 29, 2024
1 parent c640665 commit c5050fb
Show file tree
Hide file tree
Showing 3 changed files with 242 additions and 240 deletions.
55 changes: 20 additions & 35 deletions src/components/data/datagrid/datagrid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,24 @@
border-radius: var(--border-radius-l);
width: 100%;

&__table {
border-spacing: 0;
width: 100%;
}

&__caption {
&__header {
padding-block: var(--spacing-v);
padding-inline: var(--spacing-h);
text-align: start;

&:after {
clear: both;
content: "";
display: block;
}
}

&__caption .mykn-toolbar {
float: inline-start;
min-height: calc(var(--spacing-h) + var(--typography-line-height-body-xs));
}

&__caption .mykn-toolbar:not(:first-child):last-child {
float: inline-end;
&__table {
border-spacing: 0;
width: 100%;
}

&__head {
&__table &__thead {
background-color: var(--typography-color-background);
position: sticky;
top: 0;
z-index: 1;
}

&__head &__row--filter {
&__thead &__row--filter {
background-color: var(--typography-color-background-alt);

.mykn-form-control {
Expand All @@ -51,7 +35,7 @@
}
}

&__head &__cell {
&__thead &__cell {
text-align: start;
}

Expand All @@ -75,7 +59,7 @@
}
}

&__body &__row:last-child &__cell {
&__tbody &__row:last-child &__cell {
border-block-end: none;
}

Expand Down Expand Up @@ -123,6 +107,7 @@
padding-block: 0;
}

// FIXME?
base &__cell--editable:not(#{&}__cell--type-boolean):not(#{&}__cell--link) {
padding-inline: 0;
}
Expand All @@ -131,12 +116,12 @@
width: calc(100% - 1em - 3 * var(--spacing-h));
}

&__foot {
&__footer {
position: sticky;
bottom: 0;
}

&__foot &__cell {
&__footer &__cell {
border-block-start: 1px solid var(--typography-color-border);
border-block-end: none;
padding: 0;
Expand All @@ -154,7 +139,7 @@
table-layout: fixed;
}

&__caption {
&__toolbar {
background-color: var(--typography-color-background);
border-radius: var(--border-radius-l);
display: block;
Expand All @@ -164,15 +149,15 @@
}
}

&__head {
&__thead {
position: static;
}

&__head &__row--header {
&__thead &__row--header {
display: none;
}

&__body {
&__tbody {
display: block;
}

Expand Down Expand Up @@ -228,15 +213,15 @@
width: 100%;
}

&__foot {
&__footer {
display: flex;
}

&__foot &__row {
&__footer &__row {
width: 100%;
}

&__foot &__cell {
&__footer &__cell {
&:before {
display: none;
}
Expand All @@ -252,11 +237,11 @@
}

// FIXME: Improve this...
.mykn-toolbar--sticky-top + & &__head {
.mykn-toolbar--sticky-top + & &__thead {
top: calc(var(--typography-line-height-h1) + 2 * var(--spacing-v));
}

.mykn-toolbar--sticky-top:has(.mykn-form) + & &__head {
.mykn-toolbar--sticky-top:has(.mykn-form) + & &__thead {
top: calc(42px + 2 * var(--spacing-v));
}
}
Loading

0 comments on commit c5050fb

Please sign in to comment.