mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-09 05:05:52 +08:00
feat: support enter to create workspace
This commit is contained in:
@@ -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);
|
||||
}}
|
||||
|
||||
@@ -20,7 +20,8 @@ export const WorkspaceAvatar = (props: IWorkspaceAvatar) => {
|
||||
background: stringToColour(props.name || 'AFFiNE'),
|
||||
borderRadius: '50%',
|
||||
textAlign: 'center',
|
||||
lineHeight: sizeStr,
|
||||
// Let the text inside the avatar be absolutely in the play
|
||||
lineHeight: size - 2 + '[x',
|
||||
}}
|
||||
>
|
||||
{(props.name || 'AFFiNE').substring(0, 1)}
|
||||
|
||||
Reference in New Issue
Block a user