Skip to content

Commit 6a5850a

Browse files
MichaelDeBoeySaraVieira
authored andcommitted
🔨 Switch ShareButton to use useOvermind (codesandbox#2540)
* 🔨 Switch ShareButton to use useOvermind * Fix types * Fix types
1 parent 76253b8 commit 6a5850a

File tree

1 file changed

+24
-24
lines changed
  • packages/app/src/app/pages/Sandbox/Editor/Header/Buttons/ShareButton

1 file changed

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

5-
export const ShareButton = inject('store', 'signals')(
6-
hooksObserver(
7-
({
8-
signals: { modalOpened },
9-
store: {
10-
editor: {
11-
currentSandbox: { owned },
12-
},
7+
export const ShareButton: FunctionComponent = () => {
8+
const {
9+
actions: { modalOpened },
10+
state: {
11+
editor: {
12+
currentSandbox: { owned },
1313
},
14-
}) => (
15-
<Button
16-
onClick={() => {
17-
modalOpened({ modal: 'share' });
18-
}}
19-
secondary={!owned}
20-
small
21-
>
22-
<ShareIcon />
23-
Share
24-
</Button>
25-
)
26-
)
27-
);
14+
},
15+
} = useOvermind();
16+
17+
return (
18+
<Button
19+
onClick={() => modalOpened({ modal: 'share' })}
20+
secondary={!owned}
21+
small
22+
>
23+
<ShareIcon />
24+
Share
25+
</Button>
26+
);
27+
};

0 commit comments

Comments
 (0)