@@ -2,6 +2,11 @@ import { json, type LoaderFunctionArgs } from '@remix-run/node'
2
2
import { Link , NavLink , Outlet , useLoaderData } from '@remix-run/react'
3
3
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
4
4
import { ButtonLink } from '#app/components/ui/button.tsx'
5
+ import {
6
+ DropdownMenu ,
7
+ DropdownMenuContent ,
8
+ DropdownMenuTrigger ,
9
+ } from '#app/components/ui/dropdown-menu.tsx'
5
10
import { Icon } from '#app/components/ui/icon.tsx'
6
11
import { SimpleTooltip } from '#app/components/ui/tooltip.js'
7
12
import { requireUserId } from '#app/utils/auth.server.js'
@@ -46,30 +51,11 @@ export default function RecipientsLayout() {
46
51
47
52
< div className = "bg-background-alt flex min-h-0 flex-1 flex-col" >
48
53
< div className = "flex flex-col gap-4 overflow-visible border-b-2 py-4 pl-1 pr-4" >
49
- < details
50
- className = "relative"
51
- onBlur = { ( e ) => {
52
- const relatedTarget = e . relatedTarget
53
- if ( ! e . currentTarget . contains ( relatedTarget ) ) {
54
- const el = e . currentTarget
55
- // seems to cause the browser to crash if relatedTarget is null
56
- // (like clicking within the details, but not on anything in particular)
57
- // so we wrap it in a requestAnimationFrame and it closes fine.
58
- requestAnimationFrame ( ( ) => {
59
- el . removeAttribute ( 'open' )
60
- } )
61
- }
62
- } }
63
- onKeyDown = { ( e ) => {
64
- if ( e . key === 'Escape' ) {
65
- e . currentTarget . removeAttribute ( 'open' )
66
- }
67
- } }
68
- >
69
- < summary className = "hover:bg-background-alt-hover cursor-pointer px-2 py-1" >
70
- Select recipient
71
- </ summary >
72
- < div className = "bg-background-alt absolute left-0 top-full z-10 mt-1 min-w-64 max-w-full border p-2 shadow-lg" >
54
+ < DropdownMenu >
55
+ < DropdownMenuTrigger className = "hover:bg-background-alt-hover cursor-pointer px-2 py-1" >
56
+ < Icon name = "chevron-down" > Select recipient</ Icon >
57
+ </ DropdownMenuTrigger >
58
+ < DropdownMenuContent className = "min-w-64" >
73
59
{ recipients . map ( ( recipient ) => (
74
60
< NavLink
75
61
key = { recipient . id }
@@ -80,9 +66,6 @@ export default function RecipientsLayout() {
80
66
isActive ? 'underline' : '' ,
81
67
)
82
68
}
83
- onClick = { ( e ) => {
84
- e . currentTarget . closest ( 'details' ) ?. removeAttribute ( 'open' )
85
- } }
86
69
>
87
70
{ ( { isActive } ) => (
88
71
< div className = "flex items-center gap-1" >
@@ -113,10 +96,10 @@ export default function RecipientsLayout() {
113
96
No recipients found. Add one to get started.
114
97
</ div >
115
98
) }
116
- </ div >
117
- </ details >
99
+ </ DropdownMenuContent >
100
+ </ DropdownMenu >
118
101
</ div >
119
- < main className = "flex flex -1 overflow-auto" >
102
+ < main className = "flex-1 overflow-auto" >
120
103
< Outlet />
121
104
</ main >
122
105
</ div >
0 commit comments