Skip to content

Commit c094cf8

Browse files
authored
Deleting sandboxes (codesandbox#11)
* Possible to delete sandboxes * Int * Fix lint errors * Styling tweaks
1 parent 67dd9dd commit c094cf8

File tree

38 files changed

+319
-113
lines changed

38 files changed

+319
-113
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"react/jsx-filename-extension": 0,
2121
"react/sort-comp": 0,
2222
"import/no-extraneous-dependencies": 0,
23-
"arrow-parens": 0
23+
"arrow-parens": 0,
24+
"import/prefer-default-export": 0
2425
},
2526
"settings": {
2627
"import/resolver": {

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@
119119
"build": "NODE_ENV=production node scripts/build.js && gulp",
120120
"test": "jest --env=jsdom",
121121
"test:watch": "jest --watch --env=jsdom",
122-
"lint": "eslint src"
122+
"lint:app": "eslint src/app",
123+
"lint:embed": "eslint src/embed"
123124
},
124125
"jest": {
125126
"rootDir": "src",

src/app/components/Logo.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import React from 'react';
22

3-
export default ({ width = 35, height = 35, className }) => (
3+
export default ({
4+
width = 35,
5+
height = 35,
6+
className,
7+
}: { width: number, height: number, className: ?string }) => (
48
<svg
59
x="0px"
610
y="0px"
@@ -12,15 +16,15 @@ export default ({ width = 35, height = 35, className }) => (
1216
<g id="Layer_1">
1317
<polyline
1418
fill="#FFFFFF"
15-
points="719.001,851 719.001,639.848 902,533.802 902,745.267 719.001,851 "
19+
points="719.001,851 719.001,639.848 902,533.802 902,745.267 719.001,851"
1620
/>
1721
<polyline
1822
fill="#FFFFFF"
19-
points="302.082,643.438 122.167,539.135 122.167,747.741 302.082,852.573 302.082,643.438 "
23+
points="302.082,643.438 122.167,539.135 122.167,747.741 302.082,852.573 302.082,643.438"
2024
/>
2125
<polyline
2226
fill="#FFFFFF"
23-
points="511.982,275.795 694.939,169.633 512.06,63 328.436,169.987 511.982,275.795 "
27+
points="511.982,275.795 694.939,169.633 512.06,63 328.436,169.987 511.982,275.795"
2428
/>
2529
</g>
2630
<g id="Layer_2">
@@ -29,7 +33,7 @@ export default ({ width = 35, height = 35, className }) => (
2933
stroke="#FFFFFF"
3034
strokeWidth="50"
3135
strokeMiterlimit="10"
32-
points="899,287.833 509,513 509,963 "
36+
points="899,287.833 509,513 509,963"
3337
/>
3438
<line
3539
fill="none"
@@ -53,8 +57,7 @@ export default ({ width = 35, height = 35, className }) => (
5357
stroke="#FFFFFF"
5458
strokeWidth="50"
5559
strokeMiterlimit="10"
56-
points="121,739.083 510.917,963.042 901,738.333
57-
901,288 511,62 121,289 "
60+
points="121,739.083 510.917,963.042 901,738.333 901,288 511,62 121,289"
5861
/>
5962
</g>
6063
</svg>

src/app/components/Notification.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const CloseIconHandler = styled.div`
9393

9494
type Props = {
9595
title: string,
96-
body: string,
96+
body: string, // eslint-disable-line
9797
type: string,
9898
buttons: Array<NotificationButton>,
9999
close: () => void,

src/app/components/Switch.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,17 @@ const Container = styled.div`
2828
}
2929
`;
3030

31+
const getSize = ({ small }) =>
32+
(small ? 'calc(1.5rem + 2px)' : 'calc(2rem + 2px)');
33+
3134
const Dot = styled.div`
3235
transition: inherit;
3336
position: absolute;
3437
height: ${props => (props.small ? 14 : 20)}px;
3538
width: 1rem;
3639
left: 0.1rem;
3740
border-radius: 4px;
38-
transform: translateX(${props => (props.right ? props.small ? 'calc(1.5rem + 2px)' : 'calc(2rem + 2px)' : '0')});
41+
transform: translateX(${props => (props.right ? getSize(props) : '0')});
3942
top: ${({ small }) => (small ? `calc(0.1rem + 1px)` : `calc(0.1rem)`)};
4043
background-color: white;
4144
box-shadow: 0 0 4px rgba(0,0,0,0.2);

src/app/components/Tooltip.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import styled from 'styled-components';
33

4+
// eslint-disable-next-line
45
const getDirectionTransforms = ({ offset = 0, left, right, bottom, top }) => {
56
if (left) {
67
return `
@@ -29,6 +30,7 @@ const getDirectionTransforms = ({ offset = 0, left, right, bottom, top }) => {
2930
`;
3031
};
3132

33+
// eslint-disable-next-line
3234
const getDirectionArrow = ({ theme, left, right, bottom, top }) => {
3335
if (left) {
3436
return `
@@ -115,7 +117,7 @@ const Tooltip = styled.div`
115117
`;
116118

117119
type Props = {
118-
className: ?tring,
120+
className: ?string,
119121
offset: ?number,
120122
children: React.CElement,
121123
message: string,

src/app/components/buttons/Button.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ const LinkButton = styled(Link)`${styles}`;
5959
const AButton = styled.a`${styles}`;
6060
const Button = styled.button`${styles}`;
6161

62-
export default props => {
62+
type Props = {
63+
[key: any]: any,
64+
to: ?string,
65+
href: ?string,
66+
};
67+
68+
export default (props: Props) => {
6369
// Link
6470
if (props.to) {
6571
return <LinkButton {...props} />;
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import React from 'react';
2+
import testRender from 'app/utils/test/render';
3+
import { MemoryRouter } from 'react-router-dom';
4+
import Button from './Button';
5+
6+
describe('Button', () => {
7+
it('renders', () => {
8+
testRender(<Button>Test</Button>);
9+
});
10+
11+
it('renders onClick', () => {
12+
testRender(<Button onClick={() => {}}>Test</Button>);
13+
});
14+
15+
it('renders hrefs', () => {
16+
testRender(
17+
<MemoryRouter>
18+
<Button to="https://ivesvh.com">Test</Button>
19+
</MemoryRouter>,
20+
);
21+
});
22+
23+
it('renders properties', () => {
24+
testRender(<Button small>Test</Button>);
25+
});
26+
27+
it('renders disabled', () => {
28+
testRender(<Button disabled>Test</Button>);
29+
});
30+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import styled from 'styled-components';
2+
import theme from 'common/theme';
3+
4+
export default styled.button`
5+
display: inline-block;
6+
background-color: transparent;
7+
color: ${() => theme.secondary()};
8+
border: none;
9+
outline: none;
10+
cursor: pointer;
11+
text-decoration: underline;
12+
`;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
import testRender from 'app/utils/test/render';
3+
import LinkButton from './LinkButton';
4+
5+
describe('LinkButton', () => {
6+
it('renders', () => {
7+
testRender(<LinkButton>Test</LinkButton>);
8+
});
9+
10+
it('renders onClick', () => {
11+
testRender(<LinkButton onClick={() => {}}>Test</LinkButton>);
12+
});
13+
});

0 commit comments

Comments
 (0)