Skip to content

Commit 1b65452

Browse files
committed
prettify, Merge branch 'master' of https://github.com/stvnwn/windfall-elimination into stvnwn-master
2 parents 07e34ad + ef0b833 commit 1b65452

33 files changed

+686
-518
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"scripts": {
4848
"build": "gatsby build",
4949
"develop": "gatsby develop",
50-
"format": "prettier --write src/**/*.{js,jsx}",
50+
"format": "prettier --write src/**/*.{js,jsx,tsx}",
5151
"start": "npm run develop",
5252
"serve": "gatsby serve",
5353
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\""

src/components/button-link-red.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import styled from "@emotion/styled"
1+
import styled from "@emotion/styled";
22
import { ButtonLink } from "../components";
33
import { colors } from "../constants";
44

55
export const ButtonLinkRed = styled(ButtonLink)`
6+
background-color: ${colors.lime};
7+
color: ${colors.white};
8+
&:hover {
69
background-color: ${colors.lime};
7-
color: ${colors.white};
8-
&:hover {
9-
background-color: ${colors.lime};
10-
}
10+
}
1111
`;

src/components/button-link.tsx

+14-11
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@ import { Link } from "gatsby";
33
import { spacing, colors, fontSizes, radii } from "../constants";
44

55
export const ButtonLink = styled(Link)`
6-
padding: ${spacing[1]} ${spacing[2]};
7-
margin: ${spacing[2]} ${spacing[2]};
8-
background-color: ${colors.darkGreen};
9-
font-size: ${fontSizes[1]};
6+
padding: ${spacing[1]} ${spacing[2]};
7+
margin: ${spacing[2]} ${spacing[2]};
8+
background-color: ${props =>
9+
props.disabled ? colors.gray : colors.darkGreen};
10+
font-size: ${fontSizes[1]};
11+
color: ${colors.white};
12+
text-decoration: none;
13+
display: inline-block;
14+
&:hover {
15+
background-color: ${colors.lime};
1016
color: ${colors.white};
11-
text-decoration: none;
12-
display: inline-block;
13-
&:hover {
14-
background-color: ${colors.lime};
15-
color: ${colors.white};
16-
cursor: pointer;
17-
}
17+
cursor: pointer;
18+
}
19+
20+
pointer-events: ${props => props.disabled && "none"};
1821
`;

src/components/card.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import styled from "@emotion/styled";
22
import { colors, radii, spacing } from "../constants";
33

44
export const Card = styled("div")`
5-
border: 1px solid ${colors.lightblack};
6-
border-radius: ${radii[0]};
7-
padding: ${spacing[1]};
8-
margin: ${spacing[1]};
5+
border: 1px solid ${colors.lightblack};
6+
border-radius: ${radii[0]};
7+
padding: ${spacing[1]};
8+
margin: ${spacing[1]};
99
`;

src/components/display-table.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import styled from "@emotion/styled";
22
import { colors, spacing, radii } from "../constants";
33

44
export const DisplayTable = styled("table")`
5-
border-radius: ${radii[0]};
6-
margin: ${spacing[0]};
7-
border: 1px solid ${colors.gray};
8-
padding: ${spacing[0]};
5+
border-radius: ${radii[0]};
6+
margin: ${spacing[0]};
7+
border: 1px solid ${colors.gray};
8+
padding: ${spacing[0]};
99
`;

src/components/file-upload.jsx

+37-37
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
1-
import React from 'react';
1+
import React from "react";
22
import styled from "@emotion/styled";
33
import fastXml from 'fast-xml-parser';
44
import { spacing, colors, fontSizes, radii } from "../constants";
55
import { ObservableCell } from "../components";
66

77
//Upload page specific css/html
88
export const UploadButton = styled("div")`
9-
position: relative;
10-
padding: ${spacing[0]} ${spacing[0]};
11-
margin: ${spacing[2]} ${spacing[0]};
12-
overflow: hidden;
13-
background-color: ${colors.blue};
14-
font-size: ${fontSizes[1]};
15-
border-radius: ${radii[2]};
16-
color: ${colors.white};
17-
text-decoration: none;
18-
display: inline-block;
19-
width: 300px;
20-
height: 20px;
21-
&:hover {
22-
background-color: ${colors.lightblue};
23-
}
9+
position: relative;
10+
padding: ${spacing[0]} ${spacing[0]};
11+
margin: ${spacing[2]} ${spacing[0]};
12+
overflow: hidden;
13+
background-color: ${colors.blue};
14+
font-size: ${fontSizes[1]};
15+
border-radius: ${radii[2]};
16+
color: ${colors.white};
17+
text-decoration: none;
18+
display: inline-block;
19+
width: 300px;
20+
height: 20px;
21+
&:hover {
22+
background-color: ${colors.lightblue};
23+
}
2424
`;
2525

2626
export const UploadInput = styled("input")`
27-
visibility: hidden;
28-
position: relative;
29-
width: 300px;
30-
height: 50px;
31-
z-index: 1;
27+
visibility: hidden;
28+
position: relative;
29+
width: 300px;
30+
height: 50px;
31+
z-index: 1;
3232
`;
3333

3434
export const UploadLabel = styled("label")`
35-
position: absolute;
36-
font-size: ${fontSizes[1]};
37-
width: 300px;
38-
height: 50px;
35+
position: absolute;
36+
font-size: ${fontSizes[1]};
37+
width: 300px;
38+
height: 50px;
3939
`;
4040

4141
export const DisplayTable = styled("table")`
42-
border-radius: ${radii[0]};
43-
margin: ${spacing[0]};
44-
padding: 8px;
45-
max-width: 500px;
46-
margin: auto;
42+
border-radius: ${radii[0]};
43+
margin: ${spacing[0]};
44+
padding: 8px;
45+
max-width: 500px;
46+
margin: auto;
4747
`;
4848

4949
export const TableHeader = styled("th")`
50-
background-color: #dddddd;
51-
border: 1px solid #dddddd;
52-
text-align: left;
53-
padding: 8px;
50+
background-color: #dddddd;
51+
border: 1px solid #dddddd;
52+
text-align: left;
53+
padding: 8px;
5454
`;
5555

56-
export const TableRow= styled("tr")`
57-
border: 1px solid #dddddd;
56+
export const TableRow = styled("tr")`
57+
border: 1px solid #dddddd;
5858
`;
5959
//-------------------------------------------------
6060

@@ -184,4 +184,4 @@ export default class FileUpload extends React.Component {
184184
</div>
185185
)
186186
}
187-
}
187+
}

src/components/footer.tsx

+27-27
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
import { Link } from "gatsby"
2-
import React from "react"
1+
import { Link } from "gatsby";
2+
import React from "react";
33
import styled from "@emotion/styled";
44
import { colors } from "../constants";
55

66
const Wrapper = styled("footer")`
7-
background: ${colors.darkGreen};
8-
display: flex;
9-
justify-content: center;
7+
background: ${colors.darkGreen};
8+
display: flex;
9+
justify-content: center;
1010
`;
1111

1212
type Props = {
13-
siteTitle?: string;
14-
}
13+
siteTitle?: string;
14+
};
1515
export const Header: React.FC<Props> = ({ siteTitle }) => (
16-
<Wrapper>
17-
<div
18-
style={{
19-
margin: `0 auto`,
20-
maxWidth: 960,
21-
padding: `1.45rem 1.0875rem`,
22-
}}
16+
<Wrapper>
17+
<div
18+
style={{
19+
margin: `0 auto`,
20+
maxWidth: 960,
21+
padding: `1.45rem 1.0875rem`
22+
}}
23+
>
24+
<h1 style={{ margin: 0 }}>
25+
<Link
26+
to="/"
27+
style={{
28+
color: `white`,
29+
textDecoration: `none`
30+
}}
2331
>
24-
<h1 style={{ margin: 0 }}>
25-
<Link
26-
to="/"
27-
style={{
28-
color: `white`,
29-
textDecoration: `none`,
30-
}}
31-
>
32-
{siteTitle || "Windfall Awareness"}
33-
</Link>
34-
</h1>
35-
</div>
36-
</Wrapper>
32+
{siteTitle || "Windfall Awareness"}
33+
</Link>
34+
</h1>
35+
</div>
36+
</Wrapper>
3737
);

src/components/generate-runtime.tsx

+27-29
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
1-
import {Runtime, Inspector, Library} from "@observablehq/runtime";
1+
import { Runtime, Inspector, Library } from "@observablehq/runtime";
22
import notebook from "windfall-awareness-notebook-prototype";
33

44
export function generateRuntime(notebook) {
5-
const {modules, id} = notebook;
6-
var library = new Library();
7-
var map = new Map;
8-
var runtime = new Runtime(library);
9-
const main = runtime_module(id);
10-
5+
const { modules, id } = notebook;
6+
var library = new Library();
7+
var map = new Map();
8+
var runtime = new Runtime(library);
9+
const main = runtime_module(id);
1110

12-
function runtime_module(id) {
13-
let module = map.get(id);
14-
if (!module) map.set(id, module = runtime.module());
15-
return module;
16-
}
11+
function runtime_module(id) {
12+
let module = map.get(id);
13+
if (!module) map.set(id, (module = runtime.module()));
14+
return module;
15+
}
1716

18-
for (const m of modules) {
19-
const module = runtime_module(m.id);
20-
let i = 0;
21-
for (const v of m.variables) {
22-
if (v.from) {
23-
module.import(v.remote, v.name, runtime_module(v.from));
24-
} else if (module === main) {
25-
module.variable().define(v.name, v.inputs, v.value);
26-
} else {
27-
module.define(v.name, v.inputs, v.value);
28-
}
29-
++i;
30-
}
17+
for (const m of modules) {
18+
const module = runtime_module(m.id);
19+
let i = 0;
20+
for (const v of m.variables) {
21+
if (v.from) {
22+
module.import(v.remote, v.name, runtime_module(v.from));
23+
} else if (module === main) {
24+
module.variable().define(v.name, v.inputs, v.value);
25+
} else {
26+
module.define(v.name, v.inputs, v.value);
27+
}
28+
++i;
29+
}
30+
}
3131

32-
}
33-
34-
return main
35-
}
32+
return main;
33+
}

src/components/hamburger-lines.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import styled from "@emotion/styled"
1+
import styled from "@emotion/styled";
22
import { colors } from "../constants";
33

4-
export const HamburgerLines= styled('span')`
5-
background-color: ${colors.red};
6-
&:hover {
7-
background-color: ${colors.lightred};
8-
}
9-
`;
4+
export const HamburgerLines = styled("span")`
5+
background-color: ${colors.red};
6+
&:hover {
7+
background-color: ${colors.lightred};
8+
}
9+
`;

src/components/hamburger-menu.jsx

+24-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from 'react';
1+
import React from "react";
22
import { Link } from "gatsby";
3-
import styled from "@emotion/styled"
3+
import styled from "@emotion/styled";
44
import { colors, radii } from "../constants";
55

66
//Hamburger buns
@@ -24,7 +24,7 @@ export const HamburgerBuns= styled('span')`
2424
`;
2525

2626
//Hamburger menu
27-
export const HamburgerMenu = styled('ul')`
27+
export const HamburgerMenu = styled("ul")`
2828
position: absolute;
2929
width: 100px;
3030
margin: 30px 0 0 -1px;
@@ -39,11 +39,11 @@ export const HamburgerMenu = styled('ul')`
3939
transform-origin: 0% 0%;
4040
transform: translate(-100%, 0);
4141
42-
transition: transform 0.5s cubic-bezier(0.77,0.2,0.05,1.0);
42+
transition: transform 0.5s cubic-bezier(0.77, 0.2, 0.05, 1);
4343
4444
li {
45-
padding: 10px 0;
46-
font-size: 22px;
45+
padding: 10px 0;
46+
font-size: 22px;
4747
}
4848
`;
4949

@@ -92,10 +92,27 @@ export const Hamburger= styled('div')`
9292
transform: none;
9393
}
9494
95+
input:checked ~ ${HamburgerBuns} {
96+
opacity: 1;
97+
transform: rotate(45deg) translate(-3px, -3px);
98+
}
99+
100+
input:checked ~ ${HamburgerBuns}:nth-of-type(2) {
101+
opacity: 0;
102+
transform: rotate(0deg) scale(0.2, 0.2);
103+
}
104+
105+
input:checked ~ ${HamburgerBuns}:nth-of-type(3) {
106+
opacity: 1;
107+
transform: rotate(-45deg) translate(0, -3px);
108+
}
109+
110+
input:checked ~ ul {
111+
transform: none;
112+
}
95113
`;
96114

97115
export default class HamburgerHelper extends React.Component {
98-
99116
render() {
100117
return(
101118
<nav role="navigation">

0 commit comments

Comments
 (0)