Skip to content

Commit ed6adbe

Browse files
MichaelDeBoeySaraVieira
authored andcommitted
🔨 Switch CreateRepo to use useOvermind (codesandbox#2556)
1 parent eb72489 commit ed6adbe

File tree

1 file changed

+11
-13
lines changed
  • packages/app/src/app/pages/Sandbox/Editor/Workspace/items/GitHub/CreateRepo

1 file changed

+11
-13
lines changed

‎packages/app/src/app/pages/Sandbox/Editor/Workspace/items/GitHub/CreateRepo/CreateRepo.tsx‎

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,31 @@ import { Button } from '@codesandbox/common/lib/components/Button';
22
import Input from '@codesandbox/common/lib/components/Input';
33
import Margin from '@codesandbox/common/lib/components/spacing/Margin';
44
import track from '@codesandbox/common/lib/utils/analytics';
5+
import React, { ChangeEvent, FunctionComponent, HTMLAttributes } from 'react';
6+
57
import { useOvermind } from 'app/overmind';
6-
import React from 'react';
78
import {
89
WorkspaceSubtitle,
910
WorkspaceInputContainer,
1011
} from 'app/pages/Sandbox/Editor/Workspace/elements';
11-
import { Error } from './elements';
1212

13-
interface ICreateRepoProps {
14-
style?: React.CSSProperties;
15-
}
13+
import { Error } from './elements';
1614

17-
export const CreateRepo: React.FC<ICreateRepoProps> = ({ style }) => {
15+
type Props = Pick<HTMLAttributes<HTMLDivElement>, 'style'>;
16+
export const CreateRepo: FunctionComponent<Props> = ({ style }) => {
1817
const {
18+
actions: {
19+
git: { createRepoClicked, repoTitleChanged },
20+
},
1921
state: {
2022
editor: { isAllModulesSynced },
21-
git: { repoTitle, error },
22-
},
23-
actions: {
24-
git: { repoTitleChanged, createRepoClicked },
23+
git: { error, repoTitle },
2524
},
2625
} = useOvermind();
2726

2827
const updateRepoTitle = ({
2928
target: { value: title },
30-
}: React.ChangeEvent<HTMLInputElement>) => repoTitleChanged({ title });
31-
29+
}: ChangeEvent<HTMLInputElement>) => repoTitleChanged({ title });
3230
const createRepo = () => {
3331
track('Export to GitHub Clicked');
3432
createRepoClicked();
@@ -51,7 +49,7 @@ export const CreateRepo: React.FC<ICreateRepoProps> = ({ style }) => {
5149
<Margin horizontal={1} bottom={1}>
5250
<Button
5351
block
54-
disabled={Boolean(error || !repoTitle || !isAllModulesSynced)}
52+
disabled={Boolean(error) || !repoTitle || !isAllModulesSynced}
5553
onClick={createRepo}
5654
small
5755
>

0 commit comments

Comments
 (0)