Skip to content

Commit

Permalink
feat(table): added frozen header, frozen column, permanent scrollbars (
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtBlue authored and agliga committed Oct 25, 2024
1 parent 0529ac5 commit 6482514
Show file tree
Hide file tree
Showing 16 changed files with 1,649 additions and 987 deletions.
5 changes: 5 additions & 0 deletions .changeset/khaki-worms-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ebay/skin": minor
---

feat(table): added frozen header, frozen column, permanent scrollbars
36 changes: 36 additions & 0 deletions dist/mixins/_utility-mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,39 @@
@mixin inline-flex-items-centered() {
@include flex-items-centered(inline-flex);
}

@mixin scrollbars-permanent($target) {
#{$target} {
-webkit-overflow-scrolling: touch;
scroll-behavior: smooth;
/* stylelint-disable declaration-block-no-duplicate-properties */
-webkit-scroll-snap-type: mandatory;
-webkit-scroll-snap-type: x mandatory;
-ms-scroll-snap-type: mandatory;
-ms-scroll-snap-type: x mandatory;
scroll-snap-type: proximity;
scroll-snap-type: x proximity;
/* stylelint-enable declaration-block-no-duplicate-properties */
}

#{$target}::-webkit-scrollbar {
background-color: var(--color-background-faint);
border-radius: 12px;
}

#{$target}::-webkit-scrollbar:vertical {
width: 6px;
}

#{$target}::-webkit-scrollbar:horizontal {
height: 6px;
}

#{$target}::-webkit-scrollbar-thumb {
background-color: var(--color-foreground-secondary);
border-color: transparent;
border-radius: 12px;
border-right-style: inset;
box-shadow: none;
}
}
53 changes: 53 additions & 0 deletions dist/table/table.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
.table {
max-height: 90vh;
overflow-x: auto;
position: relative;
-webkit-overflow-scrolling: touch;
scroll-behavior: smooth;
scroll-snap-type: proximity;
scroll-snap-type: x proximity;
}

.table::-webkit-scrollbar {
background-color: var(--color-background-faint);
border-radius: 12px;
}

.table::-webkit-scrollbar:vertical {
width: 6px;
}

.table::-webkit-scrollbar:horizontal {
height: 6px;
}

.table::-webkit-scrollbar-thumb {
background-color: var(--color-foreground-secondary);
border-color: transparent;
border-radius: 12px;
border-right-style: inset;
box-shadow: none;
}

.table table {
Expand Down Expand Up @@ -39,8 +65,32 @@
padding: 16px;
}

.table--frozen-header thead {
position: sticky;
top: 0;
z-index: 3;
}

.table--freeze-column-1 tr td:nth-child(-n + 1),
.table--freeze-column-1 tr th:nth-child(-n + 1),
.table--freeze-column-2 tr td:nth-child(-n + 2),
.table--freeze-column-2 tr th:nth-child(-n + 2),
.table--freeze-column-3 tr td:nth-child(-n + 3),
.table--freeze-column-3 tr th:nth-child(-n + 3) {
left: 0;
position: sticky;
}

.table--full-height {
max-height: unset;
}

.table th a,
.table th button {
align-items: center;
display: flex;
font-weight: 700;
text-decoration: none;
}

.table tbody tr:last-child td,
Expand Down Expand Up @@ -102,6 +152,9 @@
text-align: center;
width: 48px;
}
.table--mode-selection tr:has(input:checked) :where(td, th) {
background-color: var(--color-background-secondary);
}

.table tbody th {
font-weight: 400;
Expand Down
1 change: 1 addition & 0 deletions dist/tokens/evo-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
--color-background-primary: var(--color-neutral-900);
--color-background-secondary: var(--color-neutral-800);
--color-background-tertiary: var(--color-neutral-700);
--color-background-faint: rgba(var(--color-neutral-100-rgb), 0.05);
--color-background-disabled: var(--color-neutral-600);
--color-background-inverse: var(--color-neutral-300);
--color-background-attention: var(--color-red-400);
Expand Down
1 change: 1 addition & 0 deletions dist/tokens/evo-light.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
--color-background-primary: var(--color-neutral-100);
--color-background-secondary: var(--color-neutral-200);
--color-background-tertiary: var(--color-neutral-300);
--color-background-faint: rgba(var(--color-neutral-900-rgb), 0.05);
--color-background-disabled: var(--color-neutral-400);
--color-background-inverse: var(--color-neutral-700);
--color-background-attention: var(--color-red-600);
Expand Down
28 changes: 28 additions & 0 deletions dist/utility/utility.css
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,31 @@
text-overflow: ellipsis;
white-space: nowrap;
}

.scrollbars-permanent {
-webkit-overflow-scrolling: touch;
scroll-behavior: smooth;
scroll-snap-type: proximity;
scroll-snap-type: x proximity;
}

.scrollbars-permanent::-webkit-scrollbar {
background-color: var(--color-background-faint);
border-radius: 12px;
}

.scrollbars-permanent::-webkit-scrollbar:vertical {
width: 6px;
}

.scrollbars-permanent::-webkit-scrollbar:horizontal {
height: 6px;
}

.scrollbars-permanent::-webkit-scrollbar-thumb {
background-color: var(--color-foreground-secondary);
border-color: transparent;
border-radius: 12px;
border-right-style: inset;
box-shadow: none;
}
29 changes: 29 additions & 0 deletions src/components/highlight-code/index.marko
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ $ let parser = input.type || "html";
$ if (parser === "js") {
parser = "babel";
}
$ const height = input.height || 400;
$ const code = input.code || input.bodyCode || "";
$ const promise = prettier.format(code.trim(), {
parser,
Expand All @@ -49,3 +50,31 @@ $ const promise = prettier.format(code.trim(), {
<pre><code class="language-plaintext">$!{error}</code></pre>
</@catch>
</await>

<style>
pre[class*=language-] {
max-height: ${height}px;
overflow: auto;
}
pre[class*=language-]::-webkit-scrollbar {
background-color: var(--color-code-scrollbar);
border-radius: 12px;
}
pre[class*=language-]::-webkit-scrollbar:vertical {
width: 6px;
}
pre[class*=language-]::-webkit-scrollbar:horizontal {
height: 6px;
}
pre[class*=language-]::-webkit-scrollbar-thumb {
background-color: var(--color-code-scrollbar-thumb);
border-color: transparent;
border-radius: 12px;
border-right-style: inset;
box-shadow: none;
}
</style>
Loading

0 comments on commit 6482514

Please sign in to comment.