Skip to content

Commit 77d4415

Browse files
SaerisCompuIves
authored andcommitted
πŸ”¨ Refactor SSEDownNotice to use hooks
1 parent 91ecea9 commit 77d4415

File tree

5 files changed

+26
-21
lines changed

5 files changed

+26
-21
lines changed

packages/app/src/app/pages/Sandbox/Editor/Workspace/SSEDownNotice/index.js renamed to packages/app/src/app/pages/Sandbox/Editor/Workspace/SSEDownNotice/SSEDownNotice.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
import React from 'react';
2-
import { observer, inject } from 'mobx-react';
31
import getTemplate from '@codesandbox/common/lib/templates';
2+
import { observer } from 'mobx-react-lite';
3+
import React from 'react';
4+
5+
import { useStore } from 'app/store';
46

57
import { Container } from './elements';
68

7-
const ConnectionNotice = ({ store }) => {
9+
export const SSEDownNotice = observer(() => {
10+
const store = useStore();
11+
812
const templateDef = getTemplate(store.editor.currentSandbox.template);
913
if (!templateDef.isServer) {
1014
return null;
@@ -18,9 +22,9 @@ const ConnectionNotice = ({ store }) => {
1822
<Container>
1923
<p
2024
style={{
21-
fontWeight: 700,
22-
color: 'white',
25+
color: '#FFFFFF',
2326
fontSize: '.875rem',
27+
fontWeight: 700,
2428
marginTop: 0,
2529
}}
2630
>
@@ -35,17 +39,15 @@ const ConnectionNotice = ({ store }) => {
3539
{"'"}t resolved with in a minute it would greatly help us if you could
3640
let us know on{' '}
3741
<a
38-
style={{ color: 'white' }}
3942
href="https://spectrum.chat/codesandbox"
40-
target="_blank"
4143
rel="noopener noreferrer"
44+
style={{ color: '#FFFFFF' }}
45+
target="_blank"
4246
>
4347
Spectrum
4448
</a>
4549
.
4650
</p>
4751
</Container>
4852
);
49-
};
50-
51-
export default inject('store')(observer(ConnectionNotice));
53+
});

β€Žpackages/app/src/app/pages/Sandbox/Editor/Workspace/SSEDownNotice/elements.jsβ€Ž

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import styled, { css } from 'styled-components';
2+
3+
export const Container = styled.div`
4+
${({ theme }) => css`
5+
background-color: ${theme.secondary};
6+
color: rgba(255, 255, 255, 0.9);
7+
font-size: 0.8rem;
8+
font-weight: 500;
9+
line-height: 1.4;
10+
padding: 1rem;
11+
`}
12+
`;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { SSEDownNotice } from './SSEDownNotice';

β€Žpackages/app/src/app/pages/Sandbox/Editor/Workspace/index.jsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import ConnectionNotice from './ConnectionNotice';
2020
import Advertisement from './Advertisement';
2121
import WorkspaceItem from './WorkspaceItem';
2222
import Chat from './Chat';
23-
import SSEDownNotice from './SSEDownNotice';
23+
import { SSEDownNotice } from './SSEDownNotice';
2424

2525
import {
2626
Container,

0 commit comments

Comments
Β (0)