Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions app/components/EquivalentCliCommand.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ export default function EquivalentCliCommand({ command }: { command: string }) {
<Button variant="ghost" size="sm" className="ml-2" onClick={() => setIsOpen(true)}>
Equivalent CLI Command
</Button>
<Modal isOpen={isOpen} onDismiss={handleDismiss}>
<Modal.Title>CLI Command</Modal.Title>

<Modal isOpen={isOpen} onDismiss={handleDismiss} title="CLI command">
<Modal.Section>
{/* todo: fix the token to disable contextual alternates in the mono font */}
<pre className="flex w-full rounded border px-4 py-3 !normal-case !tracking-normal text-mono-md bg-default border-secondary [font-feature-settings:_'calt'_off]">
Expand Down
8 changes: 5 additions & 3 deletions app/components/form/FullPageForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,11 @@ export function FullPageForm<TFieldValues extends FieldValues>({
}

const ConfirmNavigation = ({ blocker }: { blocker: Blocker }) => (
<Modal isOpen={blocker.state === 'blocked'} onDismiss={() => blocker.reset?.()}>
<Modal.Title>Confirm Navigation</Modal.Title>

<Modal
isOpen={blocker.state === 'blocked'}
onDismiss={() => blocker.reset?.()}
title="Confirm navigation"
>
<Modal.Section>
Are you sure you want to leave this page? <br /> You will lose all progress on this
form.
Expand Down
3 changes: 1 addition & 2 deletions app/pages/project/images/ImagesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ const PromoteImageModal = ({ onDismiss, imageName }: PromoteModalProps) => {
}

return (
<Modal isOpen onDismiss={onDismiss}>
<Modal.Title>Promote image</Modal.Title>
<Modal isOpen onDismiss={onDismiss} title="Promote image">
<Modal.Body>
<Modal.Section>
<p>
Expand Down
8 changes: 2 additions & 6 deletions libs/ui/lib/modal/Modal.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ export function Default() {
return (
<>
<Button onClick={() => setIsOpen(true)}>Open menu</Button>
<Modal isOpen={isOpen} onDismiss={handleDismiss}>
<Modal.Title>Title</Modal.Title>

<Modal isOpen={isOpen} onDismiss={handleDismiss} title="Title">
<Modal.Body>
<Modal.Section>
<p>
Expand Down Expand Up @@ -72,9 +70,7 @@ export function Sticky() {
return (
<>
<Button onClick={() => setIsOpen(true)}>Open menu</Button>
<Modal isOpen={isOpen} onDismiss={handleDismiss}>
<Modal.Title>Title</Modal.Title>

<Modal isOpen={isOpen} onDismiss={handleDismiss} title="Title">
<Modal.Body>
<Modal.Section>
<div className="space-y-2">
Expand Down
6 changes: 4 additions & 2 deletions libs/ui/lib/modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function Modal({ children, onDismiss, title, isOpen }: ModalProps) {
>
{title && (
<Dialog.Title asChild>
<Modal.Title id={titleId}>{title}</Modal.Title>
<ModalTitle id={titleId}>{title}</ModalTitle>
</Dialog.Title>
)}
{children}
Expand All @@ -77,7 +77,9 @@ export function Modal({ children, onDismiss, title, isOpen }: ModalProps) {
)
}

Modal.Title = ({ children, id }: { children?: React.ReactNode; id?: string }) => (
// not exported because we want to use the `title` prop on Modal so the aria
// label gets hooked up properly
const ModalTitle = ({ children, id }: { children?: React.ReactNode; id?: string }) => (
<div className="flex items-center justify-between border-b py-4 px-4 bg-secondary border-b-secondary">
<h2 className="text-sans-semi-lg" id={id}>
{children}
Expand Down