adjust shadow of BottomSheet and Menu

This commit is contained in:
thislight 2024-10-31 21:50:36 +08:00
parent e7410c7296
commit 0267bffe87
No known key found for this signature in database
GPG key ID: FCFE5192241CCD4E
4 changed files with 41 additions and 32 deletions

View file

@ -18,16 +18,9 @@
contain: strict; contain: strict;
contain-intrinsic-size: 100% 95%; contain-intrinsic-size: 100% 95%;
&::backdrop {
transition-property: background-color, opacity;
transition-duration: 120ms;
transition-timing-function: var(--tutu-anim-curve-std);
transition-behavior: allow-discrete;
}
&[open]::backdrop { &::backdrop {
background-color: black; background: none;
opacity: 0.5;
} }
box-shadow: var(--tutu-shadow-e16); box-shadow: var(--tutu-shadow-e16);
@ -67,11 +60,6 @@
overflow: hidden; overflow: hidden;
will-change: width, height, top, left; will-change: width, height, top, left;
&::backdrop {
opacity: 0;
background-color: transparent;
}
& * { & * {
overflow: hidden; overflow: hidden;
} }

14
src/material/Menu.css Normal file
View file

@ -0,0 +1,14 @@
.Menu {
position: fixed;
border: 1px solid var(--tutu-color-surface-d);
border-radius: 2px;
padding: 0;
max-width: 560px;
width: max-content;
box-shadow: var(--tutu-shadow-e8);
contain: content;
}
dialog.Menu::backdrop {
background: none;
}

View file

@ -7,6 +7,7 @@ import {
type ParentComponent, type ParentComponent,
} from "solid-js"; } from "solid-js";
import { ANIM_CURVE_STD } from "./theme"; import { ANIM_CURVE_STD } from "./theme";
import "./Menu.css";
type Props = { type Props = {
open?: boolean; open?: boolean;
@ -156,17 +157,11 @@ const Menu: ParentComponent<Props> = (props) => {
e.stopPropagation(); e.stopPropagation();
} }
}} }}
class="Menu"
style={{ style={{
position: "fixed",
left: px(anchorPos().left), left: px(anchorPos().left),
top: px(anchorPos().top), top: px(anchorPos().top),
border: "none",
"border-radius": "2px",
padding: 0,
"max-width": "560px",
width: "max-content",
/* FIXME: the content may be overflow */ /* FIXME: the content may be overflow */
"box-shadow": "var(--tutu-shadow-e8)",
}} }}
> >
<div <div

View file

@ -82,28 +82,40 @@
--tutu-color-error-on-surface: #d32f2f; --tutu-color-error-on-surface: #d32f2f;
--tutu-color-inactive-on-surface: #757575; --tutu-color-inactive-on-surface: #757575;
--tutu-color-shadow: rgba(0, 0, 0, 0.15); --tutu-color-shadow: rgba(0, 0, 0, 0.45);
--tutu-color-shadow-l1: rgba(0, 0, 0, 0.4);
--tutu-color-shadow-l2: rgba(0, 0, 0, 0.35);
--tutu-shadow-e1: 0px 1px 2px 0px var(--tutu-color-shadow);
/* Switch */ /* Switch */
--tutu-shadow-e2: 0px 2px 4px 0px var(--tutu-color-shadow); --tutu-shadow-e1: 0px 1px 2px 0px var(--tutu-color-shadow);
/* (Resting) cards, raised button, quick entry / search bar */ /* (Resting) cards, raised button, quick entry / search bar */
--tutu-shadow-e3: 0px 3px 6px 0px var(--tutu-color-shadow); --tutu-shadow-e2: 0px 2px 4px 0px var(--tutu-color-shadow);
/* Refresh indicator, quick entry / search bar (scrolled) */ /* Refresh indicator, quick entry / search bar (scrolled) */
--tutu-shadow-e4: 0px 4px 8px 0px var(--tutu-color-shadow); --tutu-shadow-e3: 0px 3px 6px 0px var(--tutu-color-shadow);
/* App bar */ /* App bar */
--tutu-shadow-e6: 0px 6px 12px 0px var(--tutu-color-shadow); --tutu-shadow-e4: 0px 4px 8px 0px var(--tutu-color-shadow);
/* Snack bar, FAB (resting) */ /* Snack bar, FAB (resting) */
--tutu-shadow-e8: 0px 8px 16px 0px var(--tutu-color-shadow); --tutu-shadow-e6: 0px 6px 12px 0px var(--tutu-color-shadow);
/* Menu, (picked-up) cards, (pressed) raise button */ /* Menu, (picked-up) cards, (pressed) raise button */
--tutu-shadow-e9: 0px 9px 18px 0px var(--tutu-color-shadow); --tutu-shadow-e8: 0px 8px 16px 0px var(--tutu-color-shadow);
/* Submenu (+1dp for each submenu) */ /* Submenu (+1dp for each submenu) */
--tutu-shadow-e12: 0px 12px 24px 0px var(--tutu-color-shadow); --tutu-shadow-e9: 0px 9px 18px 0px var(--tutu-color-shadow);
/* (pressed) FAB */ /* (pressed) FAB */
--tutu-shadow-e16: 0px 16px 32px 0px var(--tutu-color-shadow); --tutu-shadow-e12: 0px 12px 24px 0px var(--tutu-color-shadow-l1);
/* Nav drawer, right drawer, modal bottom sheet */ /* Nav drawer, right drawer, modal bottom sheet */
--tutu-shadow-e24: 0px 24px 48px 0px var(--tutu-color-shadow); --tutu-shadow-e16: 0px 16px 32px 0px var(--tutu-color-shadow-l1);
/* Dialog, picker */ /* Dialog, picker */
--tutu-shadow-e24: 0px 24px 48px 0px var(--tutu-color-shadow-l2);
--tutu-anim-curve-std: cubic-bezier(0.4, 0, 0.2, 1); --tutu-anim-curve-std: cubic-bezier(0.4, 0, 0.2, 1);
--tutu-anim-curve-deceleration: cubic-bezier(0, 0, 0.2, 1); --tutu-anim-curve-deceleration: cubic-bezier(0, 0, 0.2, 1);