From a2d43775a818a8b393e4488dcdc4c8653b47727f Mon Sep 17 00:00:00 2001 From: Charlie Park Date: Thu, 12 Dec 2024 11:10:22 -0800 Subject: [PATCH 1/3] Remove sidemodal footer when read-only --- app/components/form/SideModalForm.tsx | 24 +++++++++++++++++------- app/ui/lib/SideModal.tsx | 12 +----------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/components/form/SideModalForm.tsx b/app/components/form/SideModalForm.tsx index d1e6075fea..c037074bd3 100644 --- a/app/components/form/SideModalForm.tsx +++ b/app/components/form/SideModalForm.tsx @@ -5,11 +5,13 @@ * * Copyright Oxide Computer Company */ +import * as Dialog from '@radix-ui/react-dialog' import { useEffect, useId, useState, type ReactNode } from 'react' import type { FieldValues, UseFormReturn } from 'react-hook-form' import { NavigationType, useNavigationType } from 'react-router-dom' import type { ApiError } from '@oxide/api' +import { Close12Icon } from '@oxide/design-system/icons/react' import { Button } from '~/ui/lib/Button' import { Modal } from '~/ui/lib/Modal' @@ -127,11 +129,11 @@ export function SideModalForm({ {children} - - - {onSubmit && ( + {onSubmit && ( + + - )} - + + )} + + {/* 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 */} + + + {showNavGuard && ( )} {children} - {/* - 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 - */} - - - ) From 240fce0bbcf450936c23e406c61edc2f7f70370e Mon Sep 17 00:00:00 2001 From: Charlie Park Date: Thu, 12 Dec 2024 13:16:45 -0800 Subject: [PATCH 2/3] Update test to use X to close modal --- test/e2e/silos.e2e.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e/silos.e2e.ts b/test/e2e/silos.e2e.ts index 87a33a84da..e0b8dd1dc8 100644 --- a/test/e2e/silos.e2e.ts +++ b/test/e2e/silos.e2e.ts @@ -200,7 +200,7 @@ test('Identity providers', async ({ page }) => { 'groups' ) - await page.getByRole('button', { name: 'Cancel' }).click() + await page.getByRole('button', { name: 'Close' }).click() await expect(dialog).toBeHidden() @@ -320,7 +320,7 @@ test('Silo IP pools link pool', async ({ page }) => { await expect(modal).toBeVisible() // close modal works - await page.getByRole('button', { name: 'Cancel' }).click() + await page.getByRole('button', { name: 'Close' }).click() await expect(modal).toBeHidden() // reopen From 7fe3cfe08b5e2777247fcf15dc2028174bb11718 Mon Sep 17 00:00:00 2001 From: David Crespo Date: Fri, 13 Dec 2024 11:44:42 -0600 Subject: [PATCH 3/3] move close button back into SideModal --- app/components/form/SideModalForm.tsx | 11 +---------- app/ui/lib/SideModal.tsx | 10 +++++++++- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/app/components/form/SideModalForm.tsx b/app/components/form/SideModalForm.tsx index c037074bd3..4aadd41152 100644 --- a/app/components/form/SideModalForm.tsx +++ b/app/components/form/SideModalForm.tsx @@ -5,13 +5,12 @@ * * Copyright Oxide Computer Company */ -import * as Dialog from '@radix-ui/react-dialog' + import { useEffect, useId, useState, type ReactNode } from 'react' import type { FieldValues, UseFormReturn } from 'react-hook-form' import { NavigationType, useNavigationType } from 'react-router-dom' import type { ApiError } from '@oxide/api' -import { Close12Icon } from '@oxide/design-system/icons/react' import { Button } from '~/ui/lib/Button' import { Modal } from '~/ui/lib/Modal' @@ -147,14 +146,6 @@ export function SideModalForm({ )} - {/* 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 */} - - - - {showNavGuard && ( )} {children} + + {/* 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 */} + + +