Skip to content

Commit a9892c8

Browse files
MichaelDeBoeySaraVieira
authored andcommitted
🔨 Switch ForkButton to use useOvermind (codesandbox#2537)
1 parent 13debe3 commit a9892c8

File tree

1 file changed

+29
-26
lines changed
  • packages/app/src/app/pages/Sandbox/Editor/Header/Buttons/ForkButton

1 file changed

+29
-26
lines changed
Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,32 @@
1-
import React from 'react';
2-
import { hooksObserver, inject } from 'app/componentConnectors';
1+
import React, { FunctionComponent } from 'react';
2+
3+
import { useOvermind } from 'app/overmind';
4+
35
import { ProgressButton, ForkIcon } from './elements';
46

5-
export const ForkButton = inject('store', 'signals')(
6-
hooksObserver(
7-
({
8-
signals: {
9-
editor: { forkSandboxClicked },
10-
},
11-
store: {
12-
editor: {
13-
isForkingSandbox,
14-
currentSandbox: { owned },
15-
},
7+
export const ForkButton: FunctionComponent = () => {
8+
const {
9+
actions: {
10+
editor: { forkSandboxClicked },
11+
},
12+
state: {
13+
editor: {
14+
isForkingSandbox,
15+
currentSandbox: { owned },
1616
},
17-
}) => (
18-
<ProgressButton
19-
onClick={forkSandboxClicked}
20-
secondary={owned}
21-
loading={isForkingSandbox}
22-
small
23-
>
24-
<ForkIcon />
25-
{isForkingSandbox ? 'Forking...' : 'Fork'}
26-
</ProgressButton>
27-
)
28-
)
29-
);
17+
},
18+
} = useOvermind();
19+
20+
return (
21+
<ProgressButton
22+
loading={isForkingSandbox}
23+
onClick={forkSandboxClicked}
24+
secondary={owned}
25+
small
26+
>
27+
<ForkIcon />
28+
29+
{isForkingSandbox ? 'Forking...' : 'Fork'}
30+
</ProgressButton>
31+
);
32+
};

0 commit comments

Comments
 (0)