feat: support enter to create workspace

This commit is contained in:
tzhangchi
2023-01-06 18:46:07 +08:00
parent 2b8b1c1f38
commit 8fa9669aa8
3 changed files with 16 additions and 1 deletions
@@ -20,6 +20,12 @@ export const CreateWorkspaceModal = ({ open, onClose }: ModalProps) => {
onClose({ workspaceId: workspace.id });
setActiveWorkspace(workspace);
};
const handleKeyDown = (event: KeyboardEvent) => {
if (event.key === 'Enter') {
// 👇 Get input value
handleCreateWorkspace();
}
};
return (
<div>
<Modal open={open} onClose={onClose}>
@@ -40,6 +46,7 @@ export const CreateWorkspaceModal = ({ open, onClose }: ModalProps) => {
just one person or together as a team.
</p>
<Input
onKeyDown={handleKeyDown}
onChange={value => {
setWorkspaceName(value);
}}