Skip to content

Commit afb207c

Browse files
MichaelDeBoeySaraVieira
authored andcommitted
🔨 Switch LiveSessionEnded to use useOvermind (codesandbox#3214)
1 parent 8f4b512 commit afb207c

File tree

3 files changed

+33
-25
lines changed

3 files changed

+33
-25
lines changed

‎packages/app/src/app/pages/common/Modals/LiveSessionEnded/elements.js‎

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import styled, { css } from 'styled-components';
2+
3+
import { Explanation as ExplanationBase } from '../elements';
4+
5+
export const Container = styled.div`
6+
${({ theme }) => css`
7+
background-color: ${theme.background};
8+
padding: 1rem;
9+
margin: 0;
10+
color: rgba(255, 255, 255, 0.8);
11+
`};
12+
`;
13+
14+
export const Explanation = styled(ExplanationBase)`
15+
margin-bottom: 1rem;
16+
`;

‎packages/app/src/app/pages/common/Modals/LiveSessionEnded/index.tsx‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
import { Button } from '@codesandbox/common/lib/components/Button';
22
import Row from '@codesandbox/common/lib/components/flex/Row';
3-
import { useOvermind } from 'app/overmind';
43
import React, { FunctionComponent } from 'react';
5-
import { Explanation, Heading } from '../elements';
6-
import { Container } from './elements';
4+
5+
import { useOvermind } from 'app/overmind';
6+
7+
import { Heading } from '../elements';
8+
9+
import { Container, Explanation } from './elements';
710

811
export const LiveSessionEnded: FunctionComponent = () => {
912
const {
13+
actions: {
14+
editor: { forkSandboxClicked },
15+
modalClosed,
16+
},
1017
state: {
18+
currentModalMessage,
1119
editor: {
1220
currentSandbox: { owned },
1321
},
14-
currentModalMessage,
15-
},
16-
actions: {
17-
modalClosed,
18-
editor: { forkSandboxClicked },
1922
},
2023
} = useOvermind();
2124

@@ -26,32 +29,29 @@ export const LiveSessionEnded: FunctionComponent = () => {
2629
return (
2730
<Container>
2831
<Heading>The live session has ended</Heading>
29-
<Explanation style={{ marginBottom: '1rem' }}>
32+
33+
<Explanation>
3034
{currentModalMessage || 'The session has ended due to inactivity'},{' '}
3135
{suggestion}
3236
</Explanation>
3337

3438
<Row justifyContent="space-around">
35-
<Button small href="/s">
39+
<Button href="/s" small>
3640
Create Sandbox
3741
</Button>
3842

3943
{owned ? (
40-
<Button
41-
small
42-
onClick={() => {
43-
modalClosed();
44-
}}
45-
>
44+
<Button onClick={() => modalClosed()} small>
4645
Close Modal
4746
</Button>
4847
) : (
4948
<Button
50-
small
5149
onClick={() => {
5250
forkSandboxClicked();
51+
5352
modalClosed();
5453
}}
54+
small
5555
>
5656
Fork Sandbox
5757
</Button>

0 commit comments

Comments
 (0)