Skip to content

Commit 5775507

Browse files
MichaelDeBoeySaraVieira
authored andcommitted
🔨 Switch Function to use useOvermind (codesandbox#2577)
1 parent 7c85822 commit 5775507

File tree

1 file changed

+25
-29
lines changed
  • packages/app/src/app/pages/Sandbox/Editor/Workspace/items/Deployment/Netlify/SiteInfo/Functions/Function

1 file changed

+25
-29
lines changed
Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,33 @@
1-
import { inject, hooksObserver } from 'app/componentConnectors';
2-
import React from 'react';
1+
import { Module } from '@codesandbox/common/lib/types';
2+
import React, { FunctionComponent } from 'react';
33
import LightningIcon from 'react-icons/lib/md/flash-on';
4+
5+
import { useOvermind } from 'app/overmind';
6+
47
import { Link } from '../../../../elements';
58

69
type Props = {
7-
function: {
8-
title: string;
9-
};
10-
store: any;
10+
function: Module;
1111
};
12-
export const Function = inject('store')(
13-
hooksObserver(
14-
({
15-
function: { title },
16-
store: {
17-
deployment: {
18-
building,
19-
netlifySite: { url: siteUrl },
20-
},
12+
export const Function: FunctionComponent<Props> = ({ function: { title } }) => {
13+
const {
14+
state: {
15+
deployment: {
16+
building,
17+
netlifySite: { url: siteUrl },
2118
},
22-
}: Props) => {
23-
const functionName = title.split('.js')[0];
19+
},
20+
} = useOvermind();
21+
const functionName = title.split('.js')[0];
2422

25-
return (
26-
<Link
27-
disabled={building}
28-
href={`${siteUrl}/.netlify/functions/${functionName}`}
29-
>
30-
<LightningIcon />
23+
return (
24+
<Link
25+
disabled={building}
26+
href={`${siteUrl}/.netlify/functions/${functionName}`}
27+
>
28+
<LightningIcon />
3129

32-
{functionName}
33-
</Link>
34-
);
35-
}
36-
)
37-
);
30+
{functionName}
31+
</Link>
32+
);
33+
};

0 commit comments

Comments
 (0)