Skip to content

Commit d6a1298

Browse files
committed
Big update
1 parent 7f33769 commit d6a1298

17 files changed

Lines changed: 24208 additions & 33918 deletions

File tree

package-lock.json

Lines changed: 23817 additions & 33598 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
"babel-cli": "^6.18.0",
2525
"babel-preset-react-app": "^3.1.2",
2626
"braces": "3.0.2",
27-
"browserslist": "4.16.3",
28-
"react": "17.0.2",
29-
"react-dom": "17.0.2",
30-
"react-router-dom": "5.2.0",
31-
"react-scripts": "4.0.3"
27+
"browserslist": "^4.16.3",
28+
"react": "^17.0.2",
29+
"react-dom": "^17.0.2",
30+
"react-router-dom": "^5.2.0",
31+
"react-scripts": "^5.0.1"
3232
},
3333
"eslintConfig": {
3434
"extends": "react-app"
@@ -49,9 +49,9 @@
4949
"ansi-styles": "3.2.0"
5050
},
5151
"devDependencies": {
52-
"@types/react": "17.0.3",
53-
"@types/react-dom": "17.0.3",
54-
"@types/react-router-dom": "5.1.7",
52+
"@types/react": "^17.0.3",
53+
"@types/react-dom": "^17.0.3",
54+
"@types/react-router-dom": "^5.1.7",
5555
"source-map-loader": "^0.2.4",
5656
"ts-loader": "6.2.1",
5757
"typescript": "4.2.3"

public/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
content="width=device-width, initial-scale=1, shrink-to-fit=no"
99
/>
1010
<meta name="theme-color" content="#000000" />
11-
<link href="https://fonts.googleapis.com/css?family=Cutive+Mono|Raleway" rel="stylesheet">
11+
<link rel="preconnect" href="https://fonts.googleapis.com">
12+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
13+
<link href="https://fonts.googleapis.com/css2?family=Bitter:ital,wght@0,100;0,500;1,100&family=Inconsolata:wght@200;300;400;500&display=swap" rel="stylesheet">
1214
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
1315
<title>smcf</title>
1416
</head>

src/components/App.tsx

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,29 @@ import {Home} from './Home';
55
import {Resume} from './Resume';
66
import {Notes} from './Notes';
77
import {Contact} from './Contact';
8+
import {Art} from "./Art";
89

9-
export const App: React.FC = () => <div className="App">
10+
export const App: React.FC = () => <div className="app">
1011
<Router>
11-
<h1><Link to="/">smcf.io</Link></h1>
12+
<h1 style={{fontWeight: "lighter"}}><Link to="/">smcf.io</Link></h1>
1213
<nav>
13-
<table style={ {
14-
borderStyle: 'double none',
15-
tableLayout: 'fixed',
16-
textAlign: 'center',
17-
width: '100%'
18-
} }>
14+
<table style={{tableLayout: 'fixed', borderStyle: 'double none', textAlign: 'center'}}>
1915
<tbody>
2016
<tr>
21-
<td><Link to="/resume">resume</Link></td>
22-
<td><Link to="/projects">projects</Link></td>
17+
<td><Link to="/">home</Link></td>
18+
<td><Link to="/cv">cv</Link></td>
2319
<td><Link to="/notes">notes</Link></td>
2420
<td><Link to="/contact">contact</Link></td>
2521
</tr>
2622
</tbody>
2723
</table>
2824
</nav>
29-
<Route exact path="/" component={ Home }/>
30-
<Route path="/resume" component={ Resume }/>
31-
<Route path="/notes" component={ Notes }/>
32-
<Route path="/contact" component={ Contact }/>
25+
<main>
26+
<Route exact path="/" component={Home}/>
27+
<Route path="/cv" component={Resume}/>
28+
<Route path="/notes" component={Notes}/>
29+
<Route path="/contact" component={Contact}/>
30+
<Art/>
31+
</main>
3332
</Router>
3433
</div>

src/components/Art.tsx

Lines changed: 63 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
import React, {useEffect, useState} from 'react';
2-
import '../styles/Art.css';
1+
import React, {useEffect, useState} from 'react'
2+
import '../styles/Art.css'
3+
4+
const CELL_SIZE = 15
35

46
export const Art: React.FC<any> = () => {
5-
const [seconds, setSeconds] = useState(0);
6-
useEffect(() => {
7-
const interval = setInterval(() => setSeconds(previousValue => previousValue + 1), 200);
8-
return () => clearInterval(interval);
9-
}, []);
7+
const [seconds, setSeconds] = useState(0)
8+
const [size, setSize] = useState<{ width: number, height: number }>()
109

11-
const [size, setSize] = useState<{ width: number, height: number }>();
10+
useEffect(() => {
11+
const interval = setInterval(() => setSeconds(previousValue => previousValue + 1), 200)
12+
return () => clearInterval(interval)
13+
}, [])
1214
useEffect(() => {
1315
setSize({
1416
width: Math.floor(window.innerWidth),
@@ -17,94 +19,97 @@ export const Art: React.FC<any> = () => {
1719
const resize = () => setSize({
1820
width: Math.floor(window.innerWidth),
1921
height: Math.floor(window.innerHeight)
20-
});
21-
window.addEventListener('resize', resize);
22-
return () => window.removeEventListener('resize', resize);
23-
}, []);
22+
})
23+
window.addEventListener('resize', resize)
24+
return () => window.removeEventListener('resize', resize)
25+
}, [])
2426

25-
const [cols, setCols] = useState<number>();
26-
const [rows, setRows] = useState<number>();
27-
const [numCells, setNumCells] = useState<number>();
27+
const [cols, setCols] = useState<number>()
28+
const [rows, setRows] = useState<number>()
29+
const [numCells, setNumCells] = useState<number>()
2830

2931
useEffect(() => {
30-
if (!size) return;
31-
let cols = Math.floor(size.width / CELL_SIZE);
32-
setCols(cols);
33-
let rows = Math.floor(size.height / CELL_SIZE);
34-
setRows(rows);
32+
if (!size) return
33+
let cols = Math.floor(size.width / CELL_SIZE)
34+
setCols(cols)
35+
let rows = Math.floor(size.height / CELL_SIZE)
36+
setRows(rows)
3537
setNumCells(cols * rows)
36-
}, [size]);
38+
}, [size])
3739

3840
const [gameState, setGameState] = useState<(number[] | null)[]>([])
39-
const [cells, setCells] = useState<any[]>(new Array(numCells));
41+
const [cells, setCells] = useState<any[]>(new Array(numCells))
4042

4143
useEffect(() => setGameState(() => {
42-
if (!numCells || !rows || !cols) return [];
43-
const initialCells: (number[] | null)[] = new Array(numCells);
44+
if (!numCells || !rows || !cols) return []
45+
const initialCells: (number[] | null)[] = new Array(numCells)
4446
for (let y = 0; y < rows; y++) {
4547
for (let x = 0; x < cols; x++) {
46-
const xChance = 1 - (Math.abs(cols / 2 - x) + 20) / cols;
47-
const yChance = y / rows;
48-
const alive = Math.random() * 3 + 4 * xChance + 2 * yChance > 6;
49-
initialCells[gridToIndex(x, y, cols)] = (alive ? getRandomColor() : null);
48+
const xChance = 1 - (Math.abs(cols / 2 - x)) / cols
49+
const yChance = y / rows
50+
const alive = Math.random() * 3 + 4 * xChance + 2 * yChance > 6
51+
initialCells[gridToIndex(x, y, cols)] = (alive ? getRandomColor() : null)
5052
}
5153
}
52-
return initialCells;
54+
return initialCells
5355
}), [rows, cols, numCells])
5456

5557
useEffect(() => setCells(gameState.map((state, index) => {
56-
return state === null ? null :
57-
<Cell color={gameState[index]} index={index}/>
58-
})), [gameState]);
58+
return !state ? null : <Cell key={index} color={gameState[index]} index={index}/>
59+
})), [gameState])
5960

6061
useEffect(function updateGameState() {
61-
if (!rows || !cols) return;
62+
if (!rows || !cols) return
6263
setGameState(gameState => {
63-
const newColors = new Array(gameState.length);
64+
const newColors = new Array(gameState.length)
6465
const isAlive = (x: number, y: number): number => {
65-
if (x < 0 || x >= cols || y < 0 || y >= rows) return 0;
66-
return gameState[gridToIndex(x, y, cols)] ? 1 : 0;
66+
if (x < 0 || x >= cols || y < 0 || y >= rows) return 0
67+
return gameState[gridToIndex(x, y, cols)] ? 1 : 0
6768
}
6869
for (let x = 0; x < cols; x++) {
6970
for (let y = 0; y < rows; y++) {
70-
let centerIndex = gridToIndex(x, y, cols);
71+
let centerIndex = gridToIndex(x, y, cols)
7172
let numAlive = isAlive(x - 1, y - 1)
7273
+ isAlive(x, y - 1)
7374
+ isAlive(x + 1, y - 1)
7475
+ isAlive(x - 1, y)
7576
+ isAlive(x + 1, y)
7677
+ isAlive(x - 1, y + 1)
7778
+ isAlive(x, y + 1)
78-
+ isAlive(x + 1, y + 1);
79-
if (numAlive === 2) newColors[centerIndex] = gameState[centerIndex];
80-
else if (numAlive === 3) newColors[centerIndex] = getNeighborColor(gameState[centerIndex]);
81-
else newColors[centerIndex] = null;
79+
+ isAlive(x + 1, y + 1)
80+
if (numAlive === 2) newColors[centerIndex] = gameState[centerIndex]
81+
else if (numAlive === 3) newColors[centerIndex] = getNeighborColor(gameState[centerIndex])
82+
else newColors[centerIndex] = null
8283
}
8384
}
84-
return newColors;
85-
});
86-
}, [cols, rows, seconds]);
87-
88-
return <div className="blob">{cells}</div>;
89-
};
85+
return newColors
86+
})
87+
}, [cols, rows, seconds])
88+
return <div className="blob">{cells}</div>
89+
}
9090

91-
const CELL_SIZE = 12;
92-
const getRandomColor = () => [Math.random() * 255, Math.random() * 255, Math.random() * 255];
93-
const getNeighborColor = (color: number[] | null) => (color ?? [1, 1, 1]).map(value => (value + (Math.random() * 255)) / 2);
94-
const gridToIndex = (x: number, y: number, cols: number) => x + (y * cols);
91+
const getRandomColor = () => [Math.random() * 255, Math.random() * 255, Math.random() * 255]
92+
const getNeighborColor = (color: number[] | null) => (color ?? [1, 1, 1]).map(value => (value + (Math.random() * 255)) / 2)
93+
const gridToIndex = (x: number, y: number, cols: number) => x + (y * cols)
9594

9695
const Cell: React.FC<{ index: number, color: number[] | null }> = props => {
9796
const size = {
9897
width: Math.floor(window.innerWidth),
9998
height: Math.floor(window.innerHeight)
10099
}
101-
const cols = Math.floor(size.width / CELL_SIZE);
102-
const indexToGrid = (index: number) => [index % cols, index / cols];
103-
const [left, top] = indexToGrid(props.index).map(index => `${CELL_SIZE * index + 1}px`);
100+
const cols = Math.floor(size.width / CELL_SIZE)
101+
const indexToGrid = (index: number) => [index % cols, index / cols]
102+
const [left, top] = indexToGrid(props.index).map(index => `${CELL_SIZE * index + 1}px`)
104103

105104
return props.color ? <div
106-
className="cell"
107-
style={{left, top, background: `rgba(${props.color[0]}, ${props.color[1]}, ${props.color[2]}, .4)`}}
105+
style={{
106+
left,
107+
top,
108+
background: `rgba(${props.color[0]}, ${props.color[1]}, ${props.color[2]}, .4)`,
109+
height: `${CELL_SIZE}px`,
110+
width: `${CELL_SIZE}px`,
111+
position: 'absolute'
112+
}}
108113
/>
109-
: <div key={props.index.toString()}/>;
110-
};
114+
: <div key={props.index.toString()}/>
115+
}

src/components/Contact.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ import {PageWrapper} from "./PageWrapper";
44
const email = <a className="email" href="mailto:sofia@smcf.io">sofia@smcf.io</a>
55
const github = <a className="email" href="https://github.com/sofiacf">Github</a>
66
const linkedin = <a className="email" href="https://linkedin.com/in/smcf">LinkedIn</a>
7+
const twitter = <a className="email" href="https://twitter.com/mendlbot">Twitter</a>
78
export const Contact = () => <PageWrapper>
89
<h1>Contact</h1>
910
<div>
1011
<p>Thanks for visiting my site! I'd love to hear from you.</p>
1112
<p>If you want to get in touch, my email address is { email }.</p>
12-
<p>You can also find me on { github } and { linkedin }.</p>
13+
<p>You can also find me on { github }, { linkedin }, and { twitter }.</p>
1314
</div>
1415
</PageWrapper>

src/components/Home.tsx

Lines changed: 14 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,20 @@
11
import React from 'react';
2-
import {Link} from 'react-router-dom';
32
import '../styles/Home.css';
43
import {PageWrapper} from "./PageWrapper";
54

6-
export const Home = () => <PageWrapper>
7-
<div className={'home'}>
8-
<div>
9-
<p>Hi, I'm Sofia Chandler-Freed.</p>
10-
<p>I'm a nontraditional student, software engineer, classical singer, and former bike messenger near
11-
Boston.
12-
</p>
13-
<p>
14-
<dl>
15-
<dt>Interested in:</dt>
16-
<dd>- philosophy</dd>
17-
<dd>- linguistics</dd>
18-
<dd>- computer science, and</dd>
19-
<dd>- humor</dd>
20-
</dl>
21-
</p>
22-
23-
</div>
24-
<div>
25-
<p>
26-
<dl>
27-
<dt>You can:</dt>
28-
<dd>- <a className="email" href="mailto:sofia@smcf.io">email me</a> (sofia@smcf.io)</dd>
29-
<dd>- <Link to={'/contact'}>find me on the web</Link></dd>
30-
<dd>- look around here</dd>
31-
</dl>
32-
</p>
33-
<br/>
34-
<p>Looking for the concrete corrosion simulator? It's <a href="http://corrosion.smcf.io">here</a>!</p>
35-
</div>
5+
export const Home = () => <PageWrapper className={'home'}>
6+
<div>
7+
<p>Welcome to smcf.io, homepage of Sofia Chandler-Freed.</p>
8+
<p>I'm a nontraditional student, software engineer, classical singer, and former bike messenger near
9+
Boston.
10+
</p>
11+
<label>Interestest include:</label>
12+
<ul>
13+
<li>philosophy, linguistics, cs, and humor</li>
14+
<li>international relations</li>
15+
<li>reading/writing</li>
16+
<li>many other things</li>
17+
</ul>
3618
</div>
19+
<p>Need the concrete corrosion simulator? <a href="http://corrosion.smcf.io">Look no further</a>.</p>
3720
</PageWrapper>

src/components/Notes.tsx

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@ import {PageWrapper} from "./PageWrapper";
55

66
export const Notes: React.FC = () => <PageWrapper className={'notes'}>
77
<h1>Notes</h1>
8-
<div>
9-
<br/>
10-
<tr>
11-
<td>Little thoughts and things. Like a blog, but worse</td>
12-
</tr>
8+
Little thoughts and things.
9+
<table>
1310
<tbody>
1411
<FractalFeast/>
1512
</tbody>
16-
</div>
13+
</table>
1714
</PageWrapper>;
1815

1916
interface NoteProps {
@@ -22,17 +19,15 @@ interface NoteProps {
2219
}
2320

2421
export const Note: React.FC<NoteProps> = props => <>
25-
<tr>
26-
<td style={{width: '80%'}}>
27-
<b><h4>{props.title}</h4></b>
22+
<tr style={{display: 'flex'}}>
23+
<td style={{width: 'max-content'}}><h3>{props.title}</h3></td>
24+
<td style={{flexGrow: 1, textAlign: 'right'}}>
25+
{props.date}
2826
</td>
29-
<td><h4>{props.date}</h4></td>
3027
</tr>
3128
<tr>
3229
<td>
3330
<article>{props.children}</article>
3431
</td>
3532
</tr>
36-
<tr style={{height: '20px'}}/>
37-
<hr/>
3833
</>;

src/components/PageWrapper.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import React from 'react';
22
import '../styles/App.css';
3-
import {Art} from './Art';
43

5-
export const PageWrapper: React.FC<any> = props => <main className={props.className}>
6-
<Art/>
4+
export const PageWrapper: React.FC<any> = props => <div className={props.className} style={{width: "100%"}}>
75
{props.children}
8-
</main>
6+
</div>

0 commit comments

Comments
 (0)