Skip to content

Commit b4937ea

Browse files
MichaelDeBoeyCompuIves
authored andcommitted
πŸ”¨ Refactor Deployment to use hooks (#1969)
* πŸ”¨ Refactor Deployment Workspace to use hooks * Resolve discussions * Fix TypeScript errors * Move Netlify & Zeit components into it's own folder * Extract DeployButton * Extract SiteInfo * Extract ViewLogsButton * Extract Actions * Extract Functions * Extract DeployButton * Extract Deploys * Extract Actions * Extract Alias * Cleanup Zeit * Reactor DeploymentIntegration * Fix build * Fix Netlify build * Add observer * Fix styling of button * Make deployment button call without event
1 parent 44bc01e commit b4937ea

File tree

61 files changed

+908
-657
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+908
-657
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import React from 'react';
2+
3+
import { DetailInfo } from './DetailInfo';
4+
import {
5+
Container,
6+
Down,
7+
IntegrationBlock,
8+
Name,
9+
Notice,
10+
Up,
11+
} from './elements';
12+
13+
export const DeploymentIntegration = ({
14+
beta = false,
15+
children,
16+
color,
17+
deploy,
18+
Icon,
19+
light = false,
20+
loading = false,
21+
name,
22+
open = true,
23+
toggle,
24+
}) => (
25+
<Container>
26+
<IntegrationBlock bgColor={color} onClick={toggle}>
27+
<div>
28+
<Icon />
29+
30+
<Name light={light}>{name}</Name>
31+
32+
{beta && <Notice>Beta</Notice>}
33+
</div>
34+
35+
{open ? <Up light={light} /> : <Down light={light} />}
36+
</IntegrationBlock>
37+
38+
{open ? (
39+
<DetailInfo
40+
bgColor={color}
41+
deploy={deploy}
42+
info={children}
43+
light={light}
44+
loading={loading}
45+
/>
46+
) : null}
47+
</Container>
48+
);
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import Margin from '@codesandbox/common/lib/components/spacing/Margin';
2+
import { Button } from '@codesandbox/common/lib/components/Button';
3+
import React from 'react';
4+
5+
import { Details, Info } from './elements';
6+
7+
export const DetailInfo = ({ info, deploy, bgColor, light, loading }) => (
8+
<Details bgColor={bgColor}>
9+
<Margin right={2}>
10+
<Info light={light}>{info}</Info>
11+
</Margin>
12+
13+
<Button small disabled={loading} onClick={() => deploy()}>
14+
Deploy
15+
</Button>
16+
</Details>
17+
);

β€Žpackages/app/src/app/components/DeploymentIntegration/DetailInfo/elements.jsβ€Ž

Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import styled, { css } from 'styled-components';
2+
3+
export const Details = styled.div<{ bgColor: string }>`
4+
${({ bgColor }) => css`
5+
display: inline-flex;
6+
justify-content: space-between;
7+
align-items: center;
8+
flex: 3;
9+
padding: 0.75rem 1rem;
10+
background-color: ${bgColor};
11+
margin-top: -1px;
12+
`}
13+
`;
14+
15+
export const Heading = styled.div<{ light: boolean }>`
16+
${({ light }) => css`
17+
color: ${light ? '#000000' : '#ffffff'};
18+
font-size: 0.75rem;
19+
margin-bottom: 0.25rem;
20+
`}
21+
`;
22+
23+
export const Info = styled.div<{ light: boolean }>`
24+
${({ light }) => css`
25+
color: ${light ? '#000000' : '#ffffff'};
26+
font-weight: 400;
27+
`}
28+
`;

β€Žpackages/app/src/app/components/DeploymentIntegration/DetailInfo/index.jsβ€Ž

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { DetailInfo } from './DetailInfo';

β€Žpackages/app/src/app/components/DeploymentIntegration/elements.jsβ€Ž

Lines changed: 0 additions & 45 deletions
This file was deleted.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import BaseNotice from '@codesandbox/common/lib/components/Notice';
2+
import BaseDown from 'react-icons/lib/fa/angle-down';
3+
import BaseUp from 'react-icons/lib/fa/angle-up';
4+
import styled, { css } from 'styled-components';
5+
6+
export const Container = styled.div`
7+
${({ theme }) => css`
8+
display: inline-flex;
9+
border-radius: 4px;
10+
overflow: hidden;
11+
width: 100%;
12+
flex-direction: column;
13+
font-size: 0.875rem;
14+
15+
color: ${theme.light ? '#000000' : '#ffffff'};
16+
`}
17+
`;
18+
19+
export const Down = styled(BaseDown)<{ light: boolean }>`
20+
${({ light }) => css`
21+
fill: ${light ? '#000000' : '#ffffff'};
22+
cursor: pointer;
23+
width: 1.5rem;
24+
height: auto;
25+
`}
26+
`;
27+
28+
export const IntegrationBlock = styled.div<{ bgColor: string }>`
29+
${({ bgColor }) => css`
30+
display: inline-flex;
31+
align-items: center;
32+
cursor: pointer;
33+
box-sizing: border-box;
34+
background-color: ${bgColor};
35+
flex: 1;
36+
color: white;
37+
padding: 0.75em 0.75em;
38+
min-height: 45px;
39+
font-size: 1em;
40+
justify-content: space-between;
41+
42+
> div {
43+
display: flex;
44+
align-items: center;
45+
}
46+
`}
47+
`;
48+
49+
export const Name = styled.span<{ light: boolean }>`
50+
${({ light }) => css`
51+
margin-left: 0.75em;
52+
font-size: 1.375em;
53+
color: ${light ? '#000000' : '#ffffff'};
54+
`}
55+
`;
56+
57+
export const Notice = styled(BaseNotice)`
58+
margin-left: 0.7rem;
59+
`;
60+
61+
export const Up = styled(BaseUp)<{ light: boolean }>`
62+
${({ light }) => css`
63+
fill: ${light ? '#000000' : '#ffffff'};
64+
cursor: pointer;
65+
width: 1.5rem;
66+
height: auto;
67+
`}
68+
`;

β€Žpackages/app/src/app/components/DeploymentIntegration/index.jsβ€Ž

Lines changed: 0 additions & 67 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { DeploymentIntegration } from './DeploymentIntegration';

0 commit comments

Comments
Β (0)