Skip to content

Commit efd1bd6

Browse files
jyash97CompuIves
authored andcommitted
feat: redirect import url on pressing enter (codesandbox#2954)
1 parent a426049 commit efd1bd6

File tree

1 file changed

+10
-0
lines changed
  • packages/app/src/app/pages/Dashboard/Content/CreateNewSandbox/NewSandboxModal/Imports

1 file changed

+10
-0
lines changed

packages/app/src/app/pages/Dashboard/Content/CreateNewSandbox/NewSandboxModal/Imports/GitHubImport.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ export const GitHubImport = () => {
5454
}
5555
}, []);
5656

57+
const handleKey = useCallback(
58+
({ key }) => {
59+
if (key === 'Enter' && !error) {
60+
window.location.href = gitHubToSandboxUrl(url);
61+
}
62+
},
63+
[error, url]
64+
);
65+
5766
return (
5867
<Section style={{ flex: 6 }}>
5968
<ImportHeader>
@@ -76,6 +85,7 @@ export const GitHubImport = () => {
7685
placeholder="GitHub Repository URL..."
7786
onChange={updateUrl}
7887
value={url}
88+
onKeyDown={handleKey}
7989
/>
8090

8191
{transformedUrl ? (

0 commit comments

Comments
 (0)