Skip to content

Commit 7fe3cfe

Browse files
committed
move close button back into SideModal
1 parent 240fce0 commit 7fe3cfe

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

app/components/form/SideModalForm.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
*
66
* Copyright Oxide Computer Company
77
*/
8-
import * as Dialog from '@radix-ui/react-dialog'
8+
99
import { useEffect, useId, useState, type ReactNode } from 'react'
1010
import type { FieldValues, UseFormReturn } from 'react-hook-form'
1111
import { NavigationType, useNavigationType } from 'react-router-dom'
1212

1313
import type { ApiError } from '@oxide/api'
14-
import { Close12Icon } from '@oxide/design-system/icons/react'
1514

1615
import { Button } from '~/ui/lib/Button'
1716
import { Modal } from '~/ui/lib/Modal'
@@ -147,14 +146,6 @@ export function SideModalForm<TFieldValues extends FieldValues>({
147146
</SideModal.Footer>
148147
)}
149148

150-
{/* Close button is here at the end so we aren't automatically focusing on it when the side modal is opened. Positioned in the safe area at the top */}
151-
<Dialog.Close
152-
className="absolute right-[var(--content-gutter)] top-10 -m-2 flex rounded p-2 hover:bg-hover"
153-
aria-label="Close"
154-
>
155-
<Close12Icon className="text-default" />
156-
</Dialog.Close>
157-
158149
{showNavGuard && (
159150
<Modal
160151
isOpen

app/ui/lib/SideModal.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { animated, useTransition } from '@react-spring/web'
1010
import cn from 'classnames'
1111
import React, { useRef, type ReactNode } from 'react'
1212

13-
import { Error12Icon } from '@oxide/design-system/icons/react'
13+
import { Close12Icon, Error12Icon } from '@oxide/design-system/icons/react'
1414

1515
import { useIsOverflow } from '~/hooks/use-is-overflow'
1616
import { Message } from '~/ui/lib/Message'
@@ -115,6 +115,14 @@ export function SideModal({
115115
</div>
116116
)}
117117
{children}
118+
119+
{/* Close button is here at the end so we aren't automatically focusing on it when the side modal is opened. Positioned in the safe area at the top */}
120+
<Dialog.Close
121+
className="absolute right-[var(--content-gutter)] top-10 -m-2 flex rounded p-2 hover:bg-hover"
122+
aria-label="Close"
123+
>
124+
<Close12Icon className="text-default" />
125+
</Dialog.Close>
118126
</AnimatedDialogContent>
119127
</Dialog.Portal>
120128
</Dialog.Root>

0 commit comments

Comments
 (0)