menus: address several little big things about menu styling (#2624)

- menu: fix accidental stacking of menus
https://linear.app/tldraw/issue/TLD-2077/radix-menus-double-submenu
which is a followup to https://github.com/tldraw/tldraw/pull/2101
- cc @steveruizok I might be missing context here but looking at the
original PR I don't see why this is needed anymore? can you show me in
person?
- menu: rework checkboxes
https://linear.app/tldraw/issue/TLD-2071/improve-appearance-of-menu-checkboxes
- menu: nix the text-shadow on menus
- menu: fix the kbd being off by a couple pixels

### Change Type

- [x] `patch` — Bug fix

### Release Notes

- Fixes nits on styling on our Radix menus.
This commit is contained in:
Mime Čuvalo 2024-01-25 11:34:18 +00:00 committed by GitHub
parent 4aaeafd916
commit ace1743ae5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 10 deletions

View file

@ -1,3 +1,19 @@
<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8 8H22V22H8V8Z" stroke="black" stroke-opacity="0.5" stroke-width="2"/>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="30"
height="30"
viewBox="0 0 30 30"
fill="none"
version="1.1"
id="svg1"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs1" />
<path
d="M 6.4651362,4.9397125 H 23.974196 a 1.7194619,1.7194619 45 0 1 1.719462,1.7194619 l 0,17.5090556 a 1.779661,1.779661 135 0 1 -1.779661,1.779661 H 6.5922549 A 1.9067797,1.9067797 45 0 1 4.6854752,24.041111 V 6.7193735 a 1.779661,1.779661 135 0 1 1.779661,-1.779661 z"
stroke="#000000"
stroke-width="3"
id="path1"
transform="translate(0.81043485,0.55619755)" />
</svg>

Before

Width:  |  Height:  |  Size: 184 B

After

Width:  |  Height:  |  Size: 668 B

View file

@ -33,7 +33,6 @@
font-size: 12px;
gap: 0px;
color: var(--color-text-1);
text-shadow: 1px 1px var(--color-text-shadow);
}
.tlui-button:disabled {
@ -528,6 +527,10 @@
border-radius: 2px;
}
.tlui-kbd > span:last-child {
padding-right: 0;
}
.tlui-kbd:not(:last-child) {
margin-right: var(--space-2);
}

View file

@ -8,15 +8,8 @@ export function useMenuIsOpen(id: string, cb?: (isOpen: boolean) => void) {
const rIsOpen = useRef(false)
const trackEvent = useUiEvents()
const rLastChange = useRef(0)
const onOpenChange = useCallback(
(isOpen: boolean) => {
// prevent multiple calls in quick succession
const now = Date.now()
if (now - rLastChange.current < 50) return
rLastChange.current = now
rIsOpen.current = isOpen
editor.batch(() => {