Skip to content

Commit f51b052

Browse files
ilhamwahabiCompuIves
authored andcommitted
🔨 Refactored 🧠 Overmind Hacktober | /app/pages/CliInstructions/index.tsx : refactor to replace Cerebral with Overmind (#2656)
* ref: CliInstructions - replace Cerebral with Overmind * use named export * use named import for CliInstructions
1 parent c336af5 commit f51b052

File tree

2 files changed

+33
-33
lines changed

2 files changed

+33
-33
lines changed
Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,44 @@
11
import React, { useEffect } from 'react';
22
import MaxWidth from '@codesandbox/common/lib/components/flex/MaxWidth';
33
import Margin from '@codesandbox/common/lib/components/spacing/Margin';
4-
import { inject, hooksObserver } from 'app/componentConnectors';
4+
import { useOvermind } from 'app/overmind';
55
import { Title } from 'app/components/Title';
66
import { SubTitle } from 'app/components/SubTitle';
77
import { Navigation } from 'app/pages/common/Navigation';
88
import { Container, Content, Code } from './elements';
99

10-
const CLIInstructions = inject('signals')(
11-
hooksObserver(({ signals: { cliInstructionsMounted } }) => {
12-
useEffect(() => {
13-
cliInstructionsMounted();
14-
}, [cliInstructionsMounted]);
10+
export const CLIInstructions: React.FC = () => {
11+
const {
12+
actions: { cliInstructionsMounted },
13+
} = useOvermind();
1514

16-
return (
17-
<MaxWidth>
18-
<Margin vertical={1.5} horizontal={1.5}>
19-
<Container>
20-
<Navigation title="CLI Import" />
15+
useEffect(() => {
16+
cliInstructionsMounted();
17+
}, [cliInstructionsMounted]);
2118

22-
<Content vertical>
23-
<Title>Import from CLI</Title>
19+
return (
20+
<MaxWidth>
21+
<Margin vertical={1.5} horizontal={1.5}>
22+
<Container>
23+
<Navigation title="CLI Import" />
2424

25-
<SubTitle>
26-
1. Install the CLI <Code>npm i -g codesandbox</Code>
27-
</SubTitle>
25+
<Content vertical>
26+
<Title>Import from CLI</Title>
2827

29-
<SubTitle>
30-
2. Go to your project <Code>cd path-of-your-project</Code>
31-
</SubTitle>
28+
<SubTitle>
29+
1. Install the CLI <Code>npm i -g codesandbox</Code>
30+
</SubTitle>
3231

33-
<SubTitle>
34-
3. Deploy your project to CodeSandbox{' '}
35-
<Code>codesandbox ./</Code>
36-
</SubTitle>
37-
</Content>
38-
</Container>
39-
</Margin>
40-
</MaxWidth>
41-
);
42-
})
43-
);
32+
<SubTitle>
33+
2. Go to your project <Code>cd path-of-your-project</Code>
34+
</SubTitle>
4435

45-
// eslint-disable-next-line import/no-default-export
46-
export default CLIInstructions;
36+
<SubTitle>
37+
3. Deploy your project to CodeSandbox <Code>codesandbox ./</Code>
38+
</SubTitle>
39+
</Content>
40+
</Container>
41+
</Margin>
42+
</MaxWidth>
43+
);
44+
};

‎packages/app/src/app/pages/index.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ const GitHub = Loadable(() =>
4444
import(/* webpackChunkName: 'page-github' */ './GitHub')
4545
);
4646
const CliInstructions = Loadable(() =>
47-
import(/* webpackChunkName: 'page-cli-instructions' */ './CliInstructions')
47+
import(
48+
/* webpackChunkName: 'page-cli-instructions' */ './CliInstructions'
49+
).then(module => ({ default: module.CLIInstructions }))
4850
);
4951
const Patron = Loadable(() =>
5052
import(/* webpackChunkName: 'page-patron' */ './Patron')

0 commit comments

Comments
 (0)