forked from medusajs/medusa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dashboard): Submit forms on Cmd + Enter (medusajs#9623)
**What** - Changes all forms to only submit on Cmd/Ctrl + Enter instead of just Enter. - Cleans up the position of submit/cancel buttons in many FocusModals that still had them in the header. - Fixes responsiveness of multiple forms - Removes the SplitView component, and replaces its usages with StackedDrawer/Modal to align the UX across the project. Resolves CC-103, CC-535
- Loading branch information
1 parent
0be5005
commit 1d540af
Showing
120 changed files
with
1,135 additions
and
1,053 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
packages/admin/dashboard/src/components/layout/split-view/index.ts
This file was deleted.
Oops, something went wrong.
103 changes: 0 additions & 103 deletions
103
packages/admin/dashboard/src/components/layout/split-view/split-view.tsx
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
packages/admin/dashboard/src/components/utilities/keybound-form/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./keybound-form" |
35 changes: 35 additions & 0 deletions
35
packages/admin/dashboard/src/components/utilities/keybound-form/keybound-form.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from "react" | ||
|
||
/** | ||
* A form that can only be submitted when using the meta or control key. | ||
*/ | ||
export const KeyboundForm = React.forwardRef< | ||
HTMLFormElement, | ||
React.FormHTMLAttributes<HTMLFormElement> | ||
>(({ onSubmit, onKeyDown, ...rest }, ref) => { | ||
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => { | ||
event.preventDefault() | ||
onSubmit?.(event) | ||
} | ||
|
||
const handleKeyDown = (event: React.KeyboardEvent<HTMLFormElement>) => { | ||
if (event.key === "Enter") { | ||
event.preventDefault() | ||
|
||
if (event.metaKey || event.ctrlKey) { | ||
handleSubmit(event) | ||
} | ||
} | ||
} | ||
|
||
return ( | ||
<form | ||
{...rest} | ||
onSubmit={handleSubmit} | ||
onKeyDown={onKeyDown ?? handleKeyDown} | ||
ref={ref} | ||
/> | ||
) | ||
}) | ||
|
||
KeyboundForm.displayName = "KeyboundForm" |
1 change: 1 addition & 0 deletions
1
packages/admin/dashboard/src/components/utilities/visually-hidden/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./visually-hidden" |
5 changes: 5 additions & 0 deletions
5
packages/admin/dashboard/src/components/utilities/visually-hidden/visually-hidden.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { PropsWithChildren } from "react" | ||
|
||
export const VisuallyHidden = ({ children }: PropsWithChildren) => { | ||
return <span className="sr-only">{children}</span> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.