Skip to content

Commit 06373a3

Browse files
committed
πŸ“ Fix types for App, Apply Conventions, Update Theme Snapshot
1 parent bcaafb6 commit 06373a3

File tree

25 files changed

+702
-250
lines changed

25 files changed

+702
-250
lines changed

β€Žpackages/app/src/app/components/SubscribeForm/CheckoutForm/elements.tsβ€Ž

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import styled from 'styled-components';
22
import Input from '@codesandbox/common/lib/components/Input';
3+
import { Button } from '@codesandbox/common/lib/components/Button';
34

45
export const CardContainer = styled.div`
56
padding: 0.5rem;
@@ -28,3 +29,10 @@ export const Label = styled.label`
2829
font-size: 0.875rem;
2930
color: rgba(255, 255, 255, 0.5);
3031
`;
32+
33+
export const Submit = styled(Button).attrs({
34+
type: 'submit',
35+
})`
36+
width: 300;
37+
margin-top: 1rem;
38+
`;

β€Žpackages/app/src/app/components/SubscribeForm/CheckoutForm/index.tsxβ€Ž

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ import {
44
CardElement,
55
ReactStripeElements,
66
} from 'react-stripe-elements';
7-
import { Button } from '@codesandbox/common/lib/components/Button';
87
import { logError } from '@codesandbox/common/lib/utils/analytics';
9-
10-
import { CardContainer, StripeInput, ErrorText, Label } from './elements';
8+
import {
9+
CardContainer,
10+
StripeInput,
11+
ErrorText,
12+
Label,
13+
Submit,
14+
} from './elements';
1115

1216
interface Props {
1317
name: string;
@@ -146,13 +150,7 @@ class CheckoutFormComponent extends React.PureComponent<Props, State> {
146150
</>
147151
)}
148152

149-
<Button
150-
type="submit"
151-
disabled={loading}
152-
style={{ marginTop: '1rem', width: 300 }}
153-
>
154-
{loading ? loadingText : buttonName}
155-
</Button>
153+
<Submit disabled={loading}>{loading ? loadingText : buttonName}</Submit>
156154
</form>
157155
);
158156
}

β€Žpackages/app/src/app/pages/Dashboard/Content/CreateNewSandbox/NewSandboxModal/Imports/StackbitButton.tsxβ€Ž

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { gitHubToSandboxUrl } from '@codesandbox/common/lib/utils/url-generator'
55

66
window.addEventListener('message', receiveMessage, false);
77

8-
function receiveMessage(event) {
8+
function receiveMessage(event: MessageEvent) {
99
if (event.origin === 'https://app.stackbit.com' && event.data) {
1010
const data = JSON.parse(event.data);
1111

@@ -32,13 +32,18 @@ function openStackbit(username: string) {
3232
);
3333
}
3434

35-
interface Props {
35+
interface IStackbitButtonProps {
3636
username: string;
37-
style?: React.CSSProperties;
3837
}
3938

40-
export const StackbitButton = ({ username, style }: Props) => (
41-
<Button style={style} small onClick={() => openStackbit(username)}>
39+
export const StackbitButton: React.FC<IStackbitButtonProps> = ({
40+
username,
41+
}) => (
42+
<Button
43+
css="margin-top: 1rem; float: right;"
44+
small
45+
onClick={() => openStackbit(username)}
46+
>
4247
Generate Sandbox
4348
</Button>
4449
);

β€Žpackages/app/src/app/pages/Dashboard/Content/CreateNewSandbox/NewSandboxModal/Imports/StackbitImport.tsxβ€Ž

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ import React from 'react';
22
import { ImportHeader, ImportDescription, Section } from './elements';
33
import { StackbitButton } from './StackbitButton';
44

5-
interface Props {
5+
interface IStackbitImportProps {
66
username: string;
77
}
88

9-
export const StackbitImport = ({ username }: Props) => (
9+
export const StackbitImport: React.FC<IStackbitImportProps> = ({
10+
username,
11+
}) => (
1012
<Section style={{ flex: 4 }}>
1113
<ImportHeader>Import from Stackbit</ImportHeader>
1214
<ImportDescription>
@@ -16,10 +18,7 @@ export const StackbitImport = ({ username }: Props) => (
1618
</a>
1719
. This generates a project for you that&#39;s automatically set up with
1820
any Theme, Site Generator and CMS.
19-
<StackbitButton
20-
style={{ marginTop: '1rem', float: 'right' }}
21-
username={username}
22-
/>
21+
<StackbitButton username={username} />
2322
</ImportDescription>
2423
</Section>
2524
);

packages/app/src/app/pages/Dashboard/Content/routes/TeamView/AddTeamMember/index.tsx renamed to packages/app/src/app/pages/Dashboard/Content/routes/TeamView/AddTeamMember/AddTeamMember.tsx

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
11
import React from 'react';
2-
import styled from 'styled-components';
3-
42
import { useMutation } from '@apollo/react-hooks';
5-
63
import Input from '@codesandbox/common/lib/components/Input';
7-
import { Button } from '@codesandbox/common/lib/components/Button';
84
import track from '@codesandbox/common/lib/utils/analytics';
9-
105
import { useOvermind } from 'app/overmind';
116
import { INVITE_TO_TEAM } from '../../../../queries';
127
import { IAddTeamMemberProps, IMutationVariables } from './types';
13-
14-
const ErrorMessage = styled.div`
15-
color: ${props => props.theme.red};
16-
font-weight: 600;
17-
font-size: 0.875rem;
18-
margin-bottom: 0.5rem;
19-
`;
8+
import { ErrorMessage, AddUserForm, AddButton } from './elements';
209

2110
export const AddTeamMember: React.FC<IAddTeamMemberProps> = ({ teamId }) => {
2211
const { actions } = useOvermind();
@@ -62,18 +51,18 @@ export const AddTeamMember: React.FC<IAddTeamMemberProps> = ({ teamId }) => {
6251
return (
6352
<>
6453
{errorMessage && <ErrorMessage>{errorMessage}</ErrorMessage>}
65-
<form style={{ display: 'flex' }} onSubmit={loading ? undefined : submit}>
54+
<AddUserForm onSubmit={loading ? undefined : submit}>
6655
<Input
6756
ref={node => {
6857
input = node;
6958
}}
7059
placeholder="Add member by username"
7160
block
7261
/>
73-
<Button disabled={loading} style={{ width: 200 }} small>
62+
<AddButton disabled={loading}>
7463
{loading ? 'Adding Member...' : 'Add Member'}
75-
</Button>
76-
</form>
64+
</AddButton>
65+
</AddUserForm>
7766
</>
7867
);
7968
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import styled from 'styled-components';
2+
import { Button } from '@codesandbox/common/lib/components/Button';
3+
4+
export const ErrorMessage = styled.div`
5+
color: ${props => props.theme.red};
6+
font-weight: 600;
7+
font-size: 0.875rem;
8+
margin-bottom: 0.5rem;
9+
`;
10+
11+
export const AddUserForm = styled.form`
12+
display: flex;
13+
`;
14+
15+
export const AddButton = styled(Button).attrs({
16+
small: true,
17+
})`
18+
width: 200;
19+
`;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { AddTeamMember } from './AddTeamMember';

packages/app/src/app/pages/Sandbox/SignOutNoticeModal/index.tsx renamed to packages/app/src/app/pages/Sandbox/SignOutNoticeModal/SignOutNotice.tsx

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import React from 'react';
22
import { useOvermind } from 'app/overmind';
3-
4-
import { Button } from '@codesandbox/common/lib/components/Button';
53
import Row from '@codesandbox/common/lib/components/flex/Row';
4+
import { Container, Heading, Explanation, Close, SignIn } from './elements';
65

7-
import { Container, Heading, Explanation } from './elements';
8-
9-
export const SignOutNotice = () => {
6+
export const SignOutNotice: React.FC = () => {
107
const {
118
actions: { modalClosed, signInClicked },
129
} = useOvermind();
10+
1311
return (
1412
<Container>
1513
<Heading>You have been signed out</Heading>
@@ -23,23 +21,17 @@ export const SignOutNotice = () => {
2321
</Explanation>
2422

2523
<Row justifyContent="space-around">
26-
<Button
27-
block
28-
style={{ marginRight: '.5rem' }}
24+
<Close
2925
red
3026
onClick={() => {
3127
modalClosed();
3228
}}
3329
>
3430
Close
35-
</Button>
36-
<Button
37-
block
38-
style={{ marginLeft: '.5rem' }}
39-
onClick={() => signInClicked({ useExtraScopes: false })}
40-
>
31+
</Close>
32+
<SignIn onClick={() => signInClicked({ useExtraScopes: false })}>
4133
Sign in
42-
</Button>
34+
</SignIn>
4335
</Row>
4436
</Container>
4537
);

β€Žpackages/app/src/app/pages/Sandbox/SignOutNoticeModal/elements.tsβ€Ž

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import styled from 'styled-components';
2+
import { Button } from '@codesandbox/common/lib/components/Button';
23

34
export const Container = styled.div`
45
background-color: ${props => props.theme.background};
@@ -16,3 +17,15 @@ export const Explanation = styled.p`
1617
line-height: 1.3;
1718
margin-bottom: 2rem;
1819
`;
20+
21+
export const Close = styled(Button).attrs({
22+
block: true,
23+
})`
24+
margin-right: 0.5rem;
25+
`;
26+
27+
export const SignIn = styled(Button).attrs({
28+
block: true,
29+
})`
30+
margin-left: 0.5rem;
31+
`;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { SignOutNotice } from './SignOutNotice';

0 commit comments

Comments
Β (0)