-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Rework frozen column shadow #3969
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
base: main
Are you sure you want to change the base?
Changes from all commits
366b9c8
8004dc8
b5748e7
30d3c5f
532b09b
5e74cdc
128146f
0213833
1d7799d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,6 @@ const root = css` | |
| --rdg-selection-width: 2px; | ||
| --rdg-selection-color: hsl(207, 75%, 66%); | ||
| --rdg-font-size: 14px; | ||
| --rdg-cell-frozen-box-shadow: 2px 0 5px -2px rgba(136, 136, 136, 0.3); | ||
| --rdg-border-width: 1px; | ||
| --rdg-summary-border-width: calc(var(--rdg-border-width) * 2); | ||
| --rdg-color: light-dark(#000, #ddd); | ||
|
|
@@ -38,10 +37,6 @@ const root = css` | |
| color-scheme: light; | ||
| } | ||
|
|
||
| &:dir(rtl) { | ||
| --rdg-cell-frozen-box-shadow: -2px 0 5px -2px rgba(136, 136, 136, 0.3); | ||
| } | ||
|
|
||
| display: grid; | ||
|
|
||
| accent-color: light-dark(hsl(207deg 100% 29%), hsl(207deg 100% 79%)); | ||
|
|
@@ -59,6 +54,9 @@ const root = css` | |
| color: var(--rdg-color); | ||
| font-size: var(--rdg-font-size); | ||
|
|
||
| container-name: rdg-root; | ||
| container-type: scroll-state; | ||
|
|
||
| /* needed on Firefox to fix scrollbars */ | ||
| &::before { | ||
| content: ''; | ||
|
|
@@ -92,3 +90,35 @@ const viewportDragging = css` | |
| `; | ||
|
|
||
| export const viewportDraggingClassname = `rdg-viewport-dragging ${viewportDragging}`; | ||
|
|
||
| // Add shadow after the last frozen cell | ||
| export const frozenColumnShadowClassname = css` | ||
| position: sticky; | ||
| width: 10px; | ||
| background-image: linear-gradient( | ||
| to right, | ||
| light-dark(rgb(0 0 0 / 15%), rgb(0 0 0 / 40%)), | ||
| transparent | ||
| ); | ||
|
Comment on lines
+97
to
+102
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The shadow is wider/stronger than before, let me know if you think we should tweak it. |
||
| pointer-events: none; | ||
| z-index: 1; | ||
|
|
||
| opacity: 1; | ||
| transition: opacity 0.1s; | ||
|
|
||
| /* TODO: reverse 'opacity' and remove 'not' */ | ||
| @container rdg-root not scroll-state(scrollable: inline-start) { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Firefox/Safari will always show the shadow until they support |
||
| opacity: 0; | ||
| } | ||
|
|
||
| &:dir(rtl) { | ||
| transform: scaleX(-1); | ||
| } | ||
| `; | ||
|
|
||
| const topShadowClassname = css` | ||
| /* render above header and summary rows */ | ||
| z-index: 2; | ||
| `; | ||
|
|
||
| export const frozenColumnShadowTopClassname = `${frozenColumnShadowClassname} ${topShadowClassname}`; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the best way I found to make it work in all scenarios, including column grouping.