Skip to content

Commit f493cb3

Browse files
Surf it, scroll it, pause it, click it (#2772)
* Surf it, scroll it, pause it, click it * Ignore disabled buttons * Apply to more buttons * Update CopyToClipboard.tsx * Don't translate dropdown * Make motion safe --------- Co-authored-by: David Crespo <[email protected]>
1 parent 819b99a commit f493cb3

File tree

6 files changed

+38
-35
lines changed

6 files changed

+38
-35
lines changed

app/components/DocsPopover.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,10 @@ export const DocsPopover = ({ heading, icon, summary, links }: DocsPopoverProps)
4646
const title = `Learn about ${heading}`
4747
return (
4848
<Popover>
49-
<PopoverButton
50-
className={cn(buttonStyle({ size: 'sm', variant: 'ghost' }), 'w-8')}
51-
title={title}
52-
>
53-
<Info16Icon aria-hidden className="shrink-0" />
49+
<PopoverButton title={title}>
50+
<div className={cn(buttonStyle({ size: 'sm', variant: 'ghost' }), 'w-8')}>
51+
<Info16Icon aria-hidden className="shrink-0" />
52+
</div>
5453
</PopoverButton>
5554
<PopoverPanel
5655
// popover-panel needed for enter animation

app/components/MoreActionsMenu.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ export const MoreActionsMenu = ({
2727
}: MoreActionsMenuProps) => {
2828
return (
2929
<DropdownMenu.Root>
30-
<DropdownMenu.Trigger
31-
aria-label={label}
32-
className={cn(
33-
'flex items-center justify-center rounded border border-default hover:bg-tertiary',
34-
isSmall ? 'h-6 w-6' : 'h-8 w-8'
35-
)}
36-
>
37-
<More12Icon />
30+
<DropdownMenu.Trigger aria-label={label}>
31+
<div
32+
className={cn(
33+
'active-clicked flex items-center justify-center rounded border border-default hover:bg-tertiary',
34+
isSmall ? 'h-6 w-6' : 'h-8 w-8'
35+
)}
36+
>
37+
<More12Icon />
38+
</div>
3839
</DropdownMenu.Trigger>
3940
<DropdownMenu.Content className="mt-2">{children}</DropdownMenu.Content>
4041
</DropdownMenu.Root>

app/components/TopBar.tsx

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -132,17 +132,18 @@ function UserMenu() {
132132
const { me } = useCurrentUser()
133133
return (
134134
<DropdownMenu.Root>
135-
<DropdownMenu.Trigger
136-
className={cn(
137-
buttonStyle({ size: 'sm', variant: 'ghost' }),
138-
'flex items-center gap-1.5 !px-2 !border-secondary'
139-
)}
140-
aria-label="User menu"
141-
>
142-
<Profile16Icon className="text-tertiary" />
143-
<span className="normal-case text-sans-md text-default">
144-
{me.displayName || 'User'}
145-
</span>
135+
<DropdownMenu.Trigger aria-label="User menu">
136+
<div
137+
className={cn(
138+
buttonStyle({ size: 'sm', variant: 'ghost' }),
139+
'flex items-center gap-1.5 !px-2 !border-secondary'
140+
)}
141+
>
142+
<Profile16Icon className="text-tertiary" />
143+
<span className="normal-case text-sans-md text-default">
144+
{me.displayName || 'User'}
145+
</span>
146+
</div>
146147
</DropdownMenu.Trigger>
147148
<DropdownMenu.Content gap={8}>
148149
<DropdownMenu.LinkItem to={pb.profile()}>Settings</DropdownMenu.LinkItem>
@@ -160,16 +161,15 @@ function UserMenu() {
160161
function SiloSystemPicker({ level }: { level: 'silo' | 'system' }) {
161162
return (
162163
<DropdownMenu.Root>
163-
<DropdownMenu.Trigger
164-
className="flex items-center rounded border px-2 py-1.5 text-sans-md text-default border-secondary hover:bg-hover"
165-
aria-label="Switch between system and silo"
166-
>
167-
<div className="flex items-center text-tertiary">
168-
{level === 'system' ? <Servers16Icon /> : <Organization16Icon />}
164+
<DropdownMenu.Trigger aria-label="Switch between system and silo">
165+
<div className="active-clicked flex items-center rounded border px-2 py-1.5 text-sans-md text-default border-secondary hover:bg-hover">
166+
<div className="flex items-center text-tertiary">
167+
{level === 'system' ? <Servers16Icon /> : <Organization16Icon />}
168+
</div>
169+
<div className="ml-1.5 mr-3">{level === 'system' ? 'System' : 'Silo'}</div>
170+
{/* aria-hidden is a tip from the Reach docs */}
171+
<SelectArrows6Icon className="text-quaternary" aria-hidden />
169172
</div>
170-
<div className="ml-1.5 mr-3">{level === 'system' ? 'System' : 'Silo'}</div>
171-
{/* aria-hidden is a tip from the Reach docs */}
172-
<SelectArrows6Icon className="text-quaternary" aria-hidden />
173173
</DropdownMenu.Trigger>
174174
<DropdownMenu.Content className="mt-2 max-h-80 overflow-y-auto" anchor="bottom start">
175175
<SystemSiloItem to={pb.silos()} label="System" isSelected={level === 'system'} />

app/ui/lib/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const buttonStyle = ({
3636
variant = 'primary',
3737
}: ButtonStyleProps = {}) => {
3838
return cn(
39-
'ox-button elevation-1 rounded inline-flex items-center justify-center align-top disabled:cursor-default shrink-0',
39+
'ox-button active-clicked elevation-1 rounded inline-flex items-center justify-center align-top disabled:cursor-default shrink-0',
4040
`btn-${variant}`,
4141
sizeStyle[size],
4242
variant === 'danger'

app/ui/lib/CopyToClipboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const CopyToClipboard = ({
5353
return (
5454
<button
5555
className={cn(
56-
'relative h-5 w-5 rounded',
56+
'active-clicked relative h-5 w-5 rounded',
5757
hasCopied
5858
? 'text-accent bg-accent-secondary'
5959
: 'text-tertiary hover:text-default hover:bg-hover',

app/ui/styles/components/button.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
.ox-button {
1010
@apply relative;
1111
}
12+
.active-clicked:active:not(.visually-disabled) {
13+
@apply motion-safe:translate-y-px;
14+
}
1215
.ox-button:after {
1316
content: '';
1417
@apply absolute bottom-0 left-0 right-0 top-0 rounded border border-current opacity-[0.05];

0 commit comments

Comments
 (0)