diff --git a/part1/1.1-1.3/public/favicon.ico b/part1/1.1-1.3/public/favicon.ico new file mode 100644 index 0000000..a11777c Binary files /dev/null and b/part1/1.1-1.3/public/favicon.ico differ diff --git a/part1/1.1-1.3/public/index.html b/part1/1.1-1.3/public/index.html new file mode 100644 index 0000000..aa069f2 --- /dev/null +++ b/part1/1.1-1.3/public/index.html @@ -0,0 +1,43 @@ + + + + + + + + + + + + + React App + + + +
+ + + diff --git a/part1/1.1-1.3/public/logo192.png b/part1/1.1-1.3/public/logo192.png new file mode 100644 index 0000000..fc44b0a Binary files /dev/null and b/part1/1.1-1.3/public/logo192.png differ diff --git a/part1/1.1-1.3/public/logo512.png b/part1/1.1-1.3/public/logo512.png new file mode 100644 index 0000000..a4e47a6 Binary files /dev/null and b/part1/1.1-1.3/public/logo512.png differ diff --git a/part1/1.1-1.3/public/manifest.json b/part1/1.1-1.3/public/manifest.json new file mode 100644 index 0000000..080d6c7 --- /dev/null +++ b/part1/1.1-1.3/public/manifest.json @@ -0,0 +1,25 @@ +{ + "short_name": "React App", + "name": "Create React App Sample", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + }, + { + "src": "logo192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "logo512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/part1/1.1-1.3/public/robots.txt b/part1/1.1-1.3/public/robots.txt new file mode 100644 index 0000000..e9e57dc --- /dev/null +++ b/part1/1.1-1.3/public/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: diff --git a/part1/1.12-1.14-anecdotes/public/favicon.ico b/part1/1.12-1.14-anecdotes/public/favicon.ico new file mode 100644 index 0000000..a11777c Binary files /dev/null and b/part1/1.12-1.14-anecdotes/public/favicon.ico differ diff --git a/part1/1.12-1.14-anecdotes/public/index.html b/part1/1.12-1.14-anecdotes/public/index.html new file mode 100644 index 0000000..aa069f2 --- /dev/null +++ b/part1/1.12-1.14-anecdotes/public/index.html @@ -0,0 +1,43 @@ + + + + + + + + + + + + + React App + + + +
+ + + diff --git a/part1/1.12-1.14-anecdotes/public/logo192.png b/part1/1.12-1.14-anecdotes/public/logo192.png new file mode 100644 index 0000000..fc44b0a Binary files /dev/null and b/part1/1.12-1.14-anecdotes/public/logo192.png differ diff --git a/part1/1.12-1.14-anecdotes/public/logo512.png b/part1/1.12-1.14-anecdotes/public/logo512.png new file mode 100644 index 0000000..a4e47a6 Binary files /dev/null and b/part1/1.12-1.14-anecdotes/public/logo512.png differ diff --git a/part1/1.12-1.14-anecdotes/public/manifest.json b/part1/1.12-1.14-anecdotes/public/manifest.json new file mode 100644 index 0000000..080d6c7 --- /dev/null +++ b/part1/1.12-1.14-anecdotes/public/manifest.json @@ -0,0 +1,25 @@ +{ + "short_name": "React App", + "name": "Create React App Sample", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + }, + { + "src": "logo192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "logo512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/part1/1.12-1.14-anecdotes/public/robots.txt b/part1/1.12-1.14-anecdotes/public/robots.txt new file mode 100644 index 0000000..e9e57dc --- /dev/null +++ b/part1/1.12-1.14-anecdotes/public/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: diff --git a/part1/1.12-1.14-anecdotes/src/App.js b/part1/1.12-1.14-anecdotes/src/App.js index 9b32e72..db6b4ad 100644 --- a/part1/1.12-1.14-anecdotes/src/App.js +++ b/part1/1.12-1.14-anecdotes/src/App.js @@ -14,26 +14,46 @@ const App = () => { const [selected, setSelected] = useState(0) const [points, setPoints] = useState(Array(anecdotes.length).fill(0)) + console.log(points) + const setRandom = () => { const min = 0 const max = anecdotes.length-1 const random = Math.floor(Math.random() * (max-min+1)) + min - console.log(random) + //console.log(random) setSelected(random) } const setVote = () => { - const newpoints = {...points} + const newpoints = [...points] newpoints[selected] += 1 setPoints(newpoints) - console.log(points) } + const Best = (props) => { + const best = props.data + const mostvote = Math.max(...best) + const index = best.indexOf(mostvote); + return ( +
+

Anecdote with most votes

+

{props.notes[index]}

+ has {mostvote} votes +
+ ) + } return (
-

{anecdotes[selected]}

-

has {points[selected]} votes

- +
+

Anecdote of the day

+

{anecdotes[selected]}

+

has {points[selected]} votes

+ +
+ + + +
) } diff --git a/part1/1.6-1.11-unicafe/public/favicon.ico b/part1/1.6-1.11-unicafe/public/favicon.ico new file mode 100644 index 0000000..a11777c Binary files /dev/null and b/part1/1.6-1.11-unicafe/public/favicon.ico differ diff --git a/part1/1.6-1.11-unicafe/public/index.html b/part1/1.6-1.11-unicafe/public/index.html new file mode 100644 index 0000000..aa069f2 --- /dev/null +++ b/part1/1.6-1.11-unicafe/public/index.html @@ -0,0 +1,43 @@ + + + + + + + + + + + + + React App + + + +
+ + + diff --git a/part1/1.6-1.11-unicafe/public/logo192.png b/part1/1.6-1.11-unicafe/public/logo192.png new file mode 100644 index 0000000..fc44b0a Binary files /dev/null and b/part1/1.6-1.11-unicafe/public/logo192.png differ diff --git a/part1/1.6-1.11-unicafe/public/logo512.png b/part1/1.6-1.11-unicafe/public/logo512.png new file mode 100644 index 0000000..a4e47a6 Binary files /dev/null and b/part1/1.6-1.11-unicafe/public/logo512.png differ diff --git a/part1/1.6-1.11-unicafe/public/manifest.json b/part1/1.6-1.11-unicafe/public/manifest.json new file mode 100644 index 0000000..080d6c7 --- /dev/null +++ b/part1/1.6-1.11-unicafe/public/manifest.json @@ -0,0 +1,25 @@ +{ + "short_name": "React App", + "name": "Create React App Sample", + "icons": [ + { + "src": "favicon.ico", + "sizes": "64x64 32x32 24x24 16x16", + "type": "image/x-icon" + }, + { + "src": "logo192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "logo512.png", + "type": "image/png", + "sizes": "512x512" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/part1/1.6-1.11-unicafe/public/robots.txt b/part1/1.6-1.11-unicafe/public/robots.txt new file mode 100644 index 0000000..e9e57dc --- /dev/null +++ b/part1/1.6-1.11-unicafe/public/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: