mirror of
https://github.com/supabase/supabase.git
synced 2026-12-03 23:18:57 +00:00
## Problem - popovers, menus, selects and the chart tooltip draw a 1px `border` next to a `shadow-*`, so the edge shows as a separate gray line ## Solution - adds `floating-surface-shadow-sm` and `-md` utilities in one file, so every floating surface uses the same edge and shadow - replaces popover, menu, select and chart tooltip borders and shadows with the `md` utility, so edges blend into shadows - changes the chart tooltip background to the card surface in dark mode, so the tooltip is lighter than the page - adds a 1px outline in forced colors mode, because that mode removes box shadows | before | after | | -------|------| | <img width="696" height="371" alt="image" src="https://github.com/user-attachments/assets/0bca48bd-565d-48e0-bd44-1e804e3ebd7b" /> | <img width="696" height="371" alt="image" src="https://github.com/user-attachments/assets/6ad2d80e-806a-46a6-b022-891b55d979e4" /> | <!-- ## Preview links If relevant, include links to changed pages for easy review access. Copy the preview base URL from the Vercel bot comment on this PR. Use the following table as an example template. | Site | Live | Preview | Search for | | -------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ----------------------------- | | WWW | [/blog/your-post](https://supabase.com/blog/your-post) | [/blog/your-post](https://zone-www-dot-com-git-branch-name-supabase.vercel.app/blog/your-post) | unique phrase from the change | | Docs | [/docs/guides/your-page](https://supabase.com/docs/guides/your-page) | [/docs/guides/your-page](https://docs-git-branch-name-supabase.vercel.app/docs/guides/your-page) | unique phrase from the change | | Studio | [/dashboard](https://supabase.com/dashboard) | [/dashboard](https://studio-git-branch-name-supabase.vercel.app/dashboard) | unique phrase from the change | | Design system | [/design-system](https://supabase.com/design-system) | [/design-system](https://design-system-git-branch-name-supabase.vercel.app/design-system) | unique phrase from the change | | UI library | [/library](https://supabase.com/library) | [/library](https://ui-library-git-branch-name-supabase.vercel.app/library) | unique phrase from the change | | Knowledge base | [/kb/guides/your-page](https://supabase.com/kb/guides/your-page) | [/kb/guides/your-page](https://kb-git-branch-name-supabase.vercel.app/kb/guides/your-page) | unique phrase from the change | --> <!-- ## Additional context Optionally add any other context or screenshots. --> ## Review instructions 1. open [/design-system/docs/components/popover](https://design-system-git-antlio-floating-surface-shadows-supabase.vercel.app/design-system/docs/components/popover) and click "Open popover" 2. make sure that the popover has a soft shadow and a thin edge with no separate gray border, in light and dark theme 3. open [/design-system/docs/components/dropdown-menu](https://design-system-git-antlio-floating-surface-shadows-supabase.vercel.app/design-system/docs/components/dropdown-menu), click "Open" and hover "Invite users", and make sure that the menu and the submenu have the same edge 4. open [/design-system/docs/components/select](https://design-system-git-antlio-floating-surface-shadows-supabase.vercel.app/design-system/docs/components/select), click "Select a fruit" and make sure that the list has the same edge 5. open [/design-system/docs/components/chart](https://design-system-git-antlio-floating-surface-shadows-supabase.vercel.app/design-system/docs/components/chart) in dark theme, hover a bar in the tooltip example, and make sure that the tooltip is lighter than the page 6. in chrome devtools, open the rendering panel and set "Emulate CSS media feature forced-colors" to `active`, and make sure that the popover and the select list have an outline 7. open [/design-system/docs/components/tooltip](https://design-system-git-antlio-floating-surface-shadows-supabase.vercel.app/design-system/docs/components/tooltip), hover "Hover" and make sure that the tooltip still has its shadow from #52631 ## Checklist Check all before review: - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [ ] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
41 lines
1.8 KiB
CSS
41 lines
1.8 KiB
CSS
:root {
|
|
--floating-shadow-strength: 1;
|
|
--floating-ring-strength: calc(var(--contrast-border, 0.275625) / 0.275625);
|
|
--floating-ring-color: hsl(var(--colors-black) / calc(0.05 * var(--floating-ring-strength)));
|
|
}
|
|
|
|
[data-theme*='dark'] {
|
|
--floating-shadow-strength: 5;
|
|
--floating-ring-color: hsl(var(--colors-white) / calc(0.18 * var(--floating-ring-strength)));
|
|
}
|
|
|
|
@utility floating-surface-shadow-sm {
|
|
box-shadow:
|
|
0 18px 47px 0 hsl(var(--colors-black) / calc(0.03 * var(--floating-shadow-strength))),
|
|
0 7.5px 19px 0 hsl(var(--colors-black) / calc(0.02 * var(--floating-shadow-strength))),
|
|
0 4px 10.5px 0 hsl(var(--colors-black) / calc(0.03 * var(--floating-shadow-strength))),
|
|
0 2.3px 5.8px 0 hsl(var(--colors-black) / calc(0.03 * var(--floating-shadow-strength))),
|
|
0 1.2px 3.1px 0 hsl(var(--colors-black) / calc(0.03 * var(--floating-shadow-strength))),
|
|
0 0.5px 1.3px 0 hsl(var(--colors-black) / calc(0.02 * var(--floating-shadow-strength))),
|
|
0 0 0 1px var(--floating-ring-color);
|
|
|
|
/* forced colors mode removes box shadows */
|
|
@media (forced-colors: active) {
|
|
outline: 1px solid CanvasText;
|
|
}
|
|
}
|
|
|
|
@utility floating-surface-shadow-md {
|
|
box-shadow:
|
|
0 17.54px 23.39px 0 hsl(var(--colors-black) / calc(0.04 * var(--floating-shadow-strength))),
|
|
0 9.4px 12.5px 0 hsl(var(--colors-black) / calc(0.03 * var(--floating-shadow-strength))),
|
|
0 5.25px 7px 0 hsl(var(--colors-black) / calc(0.02 * var(--floating-shadow-strength))),
|
|
0 2.79px 3.72px -2px hsl(var(--colors-black) / calc(0.01 * var(--floating-shadow-strength))),
|
|
0 1.16px 1.5px 0 hsl(var(--colors-black) / calc(0.01 * var(--floating-shadow-strength))),
|
|
0 0 0 1px var(--floating-ring-color);
|
|
|
|
@media (forced-colors: active) {
|
|
outline: 1px solid CanvasText;
|
|
}
|
|
}
|