Skip to content

Commit ca7c48d

Browse files
committed
scaffolded
1 parent de3882e commit ca7c48d

File tree

70 files changed

+2419
-323
lines changed

Some content is hidden

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

70 files changed

+2419
-323
lines changed

.prettierignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
**/node_modules/**
2+
**/.cache/**
3+
**/build/**
4+
**/dist/**
5+
**/public/build/**
6+
**/package-lock.json
7+
**/playwright-report/**

eslint.config.js

+12-43
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,13 @@
1-
/** @type {import('@types/eslint').Linter.Config} */
2-
export default {
3-
languageOptions: { parser: await import('@typescript-eslint/parser') },
4-
plugins: {
5-
'@typescript-eslint': (await import('@typescript-eslint/eslint-plugin'))
6-
.default,
7-
import: (await import('eslint-plugin-import')).default,
1+
import defaultConfig from '@epic-web/config/eslint'
2+
3+
/** @type {import("eslint").Linter.Config} */
4+
export default [
5+
...defaultConfig,
6+
{
7+
rules: {
8+
// we leave unused vars around for the exercises
9+
'no-unused-vars': 'off',
10+
'@typescript-eslint/no-unused-vars': 'off',
11+
},
812
},
9-
ignores: [
10-
'node_modules',
11-
'build',
12-
'public/build',
13-
'playwright-report',
14-
'test-results',
15-
],
16-
rules: {
17-
// playwright requires destructuring in fixtures even if you don't use anything 🤷‍♂️
18-
'no-empty-pattern': 'off',
19-
'@typescript-eslint/consistent-type-imports': [
20-
'warn',
21-
{
22-
prefer: 'type-imports',
23-
disallowTypeAnnotations: true,
24-
fixStyle: 'inline-type-imports',
25-
},
26-
],
27-
'import/no-duplicates': ['warn', { 'prefer-inline': true }],
28-
'import/consistent-type-specifier-style': ['warn', 'prefer-inline'],
29-
'import/order': [
30-
'warn',
31-
{
32-
alphabetize: { order: 'asc', caseInsensitive: true },
33-
groups: [
34-
'builtin',
35-
'external',
36-
'internal',
37-
'parent',
38-
'sibling',
39-
'index',
40-
],
41-
},
42-
],
43-
},
44-
}
13+
]

exercises/01.example/01.problem.hello/README.mdx

-1
This file was deleted.

exercises/01.example/01.problem.hello/index.js

-8
This file was deleted.

exercises/01.example/01.problem.hello/package.json

-6
This file was deleted.

exercises/01.example/01.problem.hello/tsconfig.json

-24
This file was deleted.

exercises/01.example/01.solution.goodbye/README.mdx

-1
This file was deleted.

exercises/01.example/01.solution.goodbye/index.js

-8
This file was deleted.

exercises/01.example/01.solution.goodbye/package.json

-6
This file was deleted.

exercises/01.example/01.solution.goodbye/tsconfig.json

-24
This file was deleted.

exercises/01.example/FINISHED.mdx

-1
This file was deleted.

exercises/01.example/README.mdx

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Initial State
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
body {
2+
margin: 0;
3+
padding: 0;
4+
height: 100vh;
5+
}
6+
7+
* {
8+
box-sizing: border-box;
9+
}
10+
11+
div:has(.counter) {
12+
height: 100%;
13+
}
14+
15+
.counter {
16+
display: flex;
17+
justify-content: center;
18+
align-items: center;
19+
padding: 20px;
20+
height: 100%;
21+
22+
button {
23+
padding: 6px 12px;
24+
font-size: 20px;
25+
font-weight: 500;
26+
background-color: lch(30% 100 220);
27+
color: white;
28+
border: 4px solid lch(10% 100 200);
29+
border-radius: 3px;
30+
cursor: pointer;
31+
32+
&:hover,
33+
&:focus {
34+
background-color: lch(40% 100 220);
35+
border-color: lch(20% 100 200);
36+
}
37+
&:active {
38+
background-color: lch(50% 100 220);
39+
border-color: lch(30% 100 220);
40+
}
41+
}
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { createRoot } from 'react-dom/client'
2+
3+
// 🐨 create a `useState` function which accepts the initial state and returns
4+
// an array of the state and a function to update it.
5+
// 🦺 note you may need to ignore some typescript errors here. We'll fix them later.
6+
// Feel free to make the `useState` a generic though!
7+
8+
function Counter() {
9+
// @ts-expect-error 💣 delete this comment
10+
const [count, setCount] = useState(0)
11+
const increment = () => setCount(count + 1)
12+
return (
13+
<div className="counter">
14+
<button onClick={increment}>{count}</button>
15+
</div>
16+
)
17+
}
18+
19+
const rootEl = document.createElement('div')
20+
document.body.append(rootEl)
21+
const appRoot = createRoot(rootEl)
22+
appRoot.render(<Counter />)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Initial State
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
body {
2+
margin: 0;
3+
padding: 0;
4+
height: 100vh;
5+
}
6+
7+
* {
8+
box-sizing: border-box;
9+
}
10+
11+
div:has(.counter) {
12+
height: 100%;
13+
}
14+
15+
.counter {
16+
display: flex;
17+
justify-content: center;
18+
align-items: center;
19+
padding: 20px;
20+
height: 100%;
21+
22+
button {
23+
padding: 6px 12px;
24+
font-size: 20px;
25+
font-weight: 500;
26+
background-color: lch(30% 100 220);
27+
color: white;
28+
border: 4px solid lch(10% 100 200);
29+
border-radius: 3px;
30+
cursor: pointer;
31+
32+
&:hover,
33+
&:focus {
34+
background-color: lch(40% 100 220);
35+
border-color: lch(20% 100 200);
36+
}
37+
&:active {
38+
background-color: lch(50% 100 220);
39+
border-color: lch(30% 100 220);
40+
}
41+
}
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { createRoot } from 'react-dom/client'
2+
3+
function useState<State>(initialState: State) {
4+
let state = initialState
5+
const setState = (newState: State) => (state = newState)
6+
return [state, setState] as const
7+
}
8+
9+
function Counter() {
10+
const [count, setCount] = useState(0)
11+
const increment = () => setCount(count + 1)
12+
return (
13+
<div className="counter">
14+
<button onClick={increment}>{count}</button>
15+
</div>
16+
)
17+
}
18+
19+
const rootEl = document.createElement('div')
20+
document.body.append(rootEl)
21+
const appRoot = createRoot(rootEl)
22+
appRoot.render(<Counter />)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Update State
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
body {
2+
margin: 0;
3+
padding: 0;
4+
height: 100vh;
5+
}
6+
7+
* {
8+
box-sizing: border-box;
9+
}
10+
11+
div:has(.counter) {
12+
height: 100%;
13+
}
14+
15+
.counter {
16+
display: flex;
17+
justify-content: center;
18+
align-items: center;
19+
padding: 20px;
20+
height: 100%;
21+
22+
button {
23+
padding: 6px 12px;
24+
font-size: 20px;
25+
font-weight: 500;
26+
background-color: lch(30% 100 220);
27+
color: white;
28+
border: 4px solid lch(10% 100 200);
29+
border-radius: 3px;
30+
cursor: pointer;
31+
32+
&:hover,
33+
&:focus {
34+
background-color: lch(40% 100 220);
35+
border-color: lch(20% 100 200);
36+
}
37+
&:active {
38+
background-color: lch(50% 100 220);
39+
border-color: lch(30% 100 220);
40+
}
41+
}
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { createRoot } from 'react-dom/client'
2+
3+
function useState<State>(initialState: State) {
4+
let state = initialState
5+
const setState = (newState: State) => (state = newState)
6+
return [state, setState] as const
7+
}
8+
9+
function Counter() {
10+
const [count, setCount] = useState(0)
11+
const increment = () => setCount(count + 1)
12+
return (
13+
<div className="counter">
14+
<button onClick={increment}>{count}</button>
15+
</div>
16+
)
17+
}
18+
19+
const rootEl = document.createElement('div')
20+
document.body.append(rootEl)
21+
const appRoot = createRoot(rootEl)
22+
appRoot.render(<Counter />)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Update State

0 commit comments

Comments
 (0)