|
1 | | -import React from 'react'; |
2 | 1 | import track from '@codesandbox/common/lib/utils/analytics'; |
3 | | -import { inject, hooksObserver } from 'app/componentConnectors'; |
| 2 | +import React, { FunctionComponent } from 'react'; |
| 3 | + |
4 | 4 | import { DeploymentIntegration } from 'app/components/DeploymentIntegration'; |
5 | 5 | import { NetlifyLogo } from 'app/components/NetlifyLogo'; |
| 6 | +import { useOvermind } from 'app/overmind'; |
| 7 | + |
6 | 8 | import { DeployButtonContainer } from '../../elements'; |
7 | 9 |
|
8 | 10 | type Props = { |
9 | 11 | isOpen: boolean; |
10 | 12 | toggle: () => void; |
11 | | - store: any; |
12 | | - signals: any; |
13 | 13 | }; |
| 14 | +export const DeployButton: FunctionComponent<Props> = ({ isOpen, toggle }) => { |
| 15 | + const { |
| 16 | + actions: { |
| 17 | + deployment: { deployWithNetlify }, |
| 18 | + }, |
| 19 | + state: { |
| 20 | + deployment: { building, deploying }, |
| 21 | + }, |
| 22 | + } = useOvermind(); |
14 | 23 |
|
15 | | -export const DeployButton = inject('store', 'signals')( |
16 | | - hooksObserver( |
17 | | - ({ |
18 | | - isOpen, |
19 | | - toggle, |
20 | | - signals: { |
21 | | - deployment: { deployWithNetlify }, |
22 | | - }, |
23 | | - store: { |
24 | | - deployment: { building, deploying }, |
25 | | - }, |
26 | | - }: Props) => ( |
27 | | - <DeployButtonContainer> |
28 | | - <DeploymentIntegration |
29 | | - beta |
30 | | - bgColor="#FFFFFF" |
31 | | - onDeploy={() => { |
32 | | - track('Deploy Clicked', { provider: 'netlify' }); |
33 | | - deployWithNetlify({}); |
34 | | - }} |
35 | | - Icon={NetlifyLogo} |
36 | | - light |
37 | | - loading={deploying || building} |
38 | | - name="netlify" |
39 | | - open={isOpen} |
40 | | - onToggle={toggle} |
41 | | - > |
42 | | - Deploy your sandbox site on{' '} |
43 | | - <a |
44 | | - href="https://netlify.com" |
45 | | - rel="noreferrer noopener" |
46 | | - target="_blank" |
47 | | - > |
48 | | - <span>Netlify</span> |
49 | | - </a> |
50 | | - </DeploymentIntegration> |
51 | | - </DeployButtonContainer> |
52 | | - ) |
53 | | - ) |
54 | | -); |
| 24 | + return ( |
| 25 | + <DeployButtonContainer> |
| 26 | + <DeploymentIntegration |
| 27 | + beta |
| 28 | + bgColor="#FFFFFF" |
| 29 | + onDeploy={() => { |
| 30 | + track('Deploy Clicked', { provider: 'netlify' }); |
| 31 | + deployWithNetlify(); |
| 32 | + }} |
| 33 | + Icon={NetlifyLogo} |
| 34 | + light |
| 35 | + loading={deploying || building} |
| 36 | + name="netlify" |
| 37 | + open={isOpen} |
| 38 | + onToggle={toggle} |
| 39 | + > |
| 40 | + Deploy your sandbox site on{' '} |
| 41 | + <a href="https://netlify.com" rel="noreferrer noopener" target="_blank"> |
| 42 | + <span>Netlify</span> |
| 43 | + </a> |
| 44 | + </DeploymentIntegration> |
| 45 | + </DeployButtonContainer> |
| 46 | + ); |
| 47 | +}; |
0 commit comments