From 2cdefd6f584fe8ad4bc97798c5ff968dc705b6b4 Mon Sep 17 00:00:00 2001 From: Ken Date: Mon, 25 Feb 2019 16:54:28 -0800 Subject: [PATCH 01/32] adding tracking for day 2 tracking goodness --- assets/track.js | 8 ++++++++ index.html | 11 +---------- step2-01/demo/index.html | 1 + step2-01/exercise/index.html | 1 + step2-02/demo/index.html | 1 + step2-02/exercise/index.html | 1 + step2-03/demo/index.html | 1 + step2-03/exercise/index.html | 1 + step2-04/demo/index.html | 1 + step2-04/exercise/index.html | 1 + step2-05/demo/index.html | 1 + step2-05/exercise/index.html | 1 + step2-06/demo/index.html | 1 + step2-06/exercise/index.html | 1 + step2-07/demo/index.html | 1 + step2-07/exercise/index.html | 1 + step2-08/demo/index.html | 1 + step2-08/exercise/index.html | 1 + step2-09/demo/index.html | 1 + step2-09/exercise/index.html | 1 + 20 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 assets/track.js diff --git a/assets/track.js b/assets/track.js new file mode 100644 index 0000000..f94f793 --- /dev/null +++ b/assets/track.js @@ -0,0 +1,8 @@ +// prettier-ignore +var appInsights=window.appInsights||function(a){ + function b(a){c[a]=function(){var b=arguments;c.queue.push(function(){c[a].apply(c,b)})}}var c={config:a},d=document,e=window;setTimeout(function(){var b=d.createElement("script");b.src=a.url||"https://az416426.vo.msecnd.net/scripts/a/ai.0.js",d.getElementsByTagName("script")[0].parentNode.appendChild(b)});try{c.cookie=d.cookie}catch(a){}c.queue=[];for(var f=["Event","Exception","Metric","PageView","Trace","Dependency"];f.length;)b("track"+f.pop());if(b("setAuthenticatedUserContext"),b("clearAuthenticatedUserContext"),b("startTrackEvent"),b("stopTrackEvent"),b("startTrackPage"),b("stopTrackPage"),b("flush"),!a.disableExceptionTracking){f="onerror",b("_"+f);var g=e[f];e[f]=function(a,b,d,e,h){var i=g&&g(a,b,d,e,h);return!0!==i&&c["_"+f](a,b,d,e,h),i}}return c +}({ + instrumentationKey: "6ad37ae0-c4ab-4739-925c-1e2773c31f17" +}); +// prettier-ignore +window.appInsights=appInsights,appInsights.queue&&0===appInsights.queue.length&&appInsights.trackPageView(); diff --git a/index.html b/index.html index 534e454..11baad6 100644 --- a/index.html +++ b/index.html @@ -4,16 +4,6 @@ -
@@ -174,5 +164,6 @@
  • Playground
  • + diff --git a/step2-01/demo/index.html b/step2-01/demo/index.html index bec0a0d..51959a8 100644 --- a/step2-01/demo/index.html +++ b/step2-01/demo/index.html @@ -8,5 +8,6 @@
    Nothing to show here, just look at your console window for output. Hit F12 to open console window.
    + diff --git a/step2-01/exercise/index.html b/step2-01/exercise/index.html index bec0a0d..51959a8 100644 --- a/step2-01/exercise/index.html +++ b/step2-01/exercise/index.html @@ -8,5 +8,6 @@
    Nothing to show here, just look at your console window for output. Hit F12 to open console window.
    + diff --git a/step2-02/demo/index.html b/step2-02/demo/index.html index 6025e9f..3bde031 100644 --- a/step2-02/demo/index.html +++ b/step2-02/demo/index.html @@ -6,5 +6,6 @@
    + diff --git a/step2-02/exercise/index.html b/step2-02/exercise/index.html index 6025e9f..3bde031 100644 --- a/step2-02/exercise/index.html +++ b/step2-02/exercise/index.html @@ -6,5 +6,6 @@
    + diff --git a/step2-03/demo/index.html b/step2-03/demo/index.html index 6025e9f..3bde031 100644 --- a/step2-03/demo/index.html +++ b/step2-03/demo/index.html @@ -6,5 +6,6 @@
    + diff --git a/step2-03/exercise/index.html b/step2-03/exercise/index.html index 6025e9f..3bde031 100644 --- a/step2-03/exercise/index.html +++ b/step2-03/exercise/index.html @@ -6,5 +6,6 @@
    + diff --git a/step2-04/demo/index.html b/step2-04/demo/index.html index 7990ebe..f6ea247 100644 --- a/step2-04/demo/index.html +++ b/step2-04/demo/index.html @@ -10,5 +10,6 @@
    npm test
    in the command line. + diff --git a/step2-04/exercise/index.html b/step2-04/exercise/index.html index 7990ebe..f6ea247 100644 --- a/step2-04/exercise/index.html +++ b/step2-04/exercise/index.html @@ -10,5 +10,6 @@
    npm test
    in the command line. + diff --git a/step2-05/demo/index.html b/step2-05/demo/index.html index 7990ebe..f6ea247 100644 --- a/step2-05/demo/index.html +++ b/step2-05/demo/index.html @@ -10,5 +10,6 @@
    npm test
    in the command line. + diff --git a/step2-05/exercise/index.html b/step2-05/exercise/index.html index 7990ebe..f6ea247 100644 --- a/step2-05/exercise/index.html +++ b/step2-05/exercise/index.html @@ -10,5 +10,6 @@
    npm test
    in the command line. + diff --git a/step2-06/demo/index.html b/step2-06/demo/index.html index 7990ebe..f6ea247 100644 --- a/step2-06/demo/index.html +++ b/step2-06/demo/index.html @@ -10,5 +10,6 @@
    npm test
    in the command line. + diff --git a/step2-06/exercise/index.html b/step2-06/exercise/index.html index 7990ebe..f6ea247 100644 --- a/step2-06/exercise/index.html +++ b/step2-06/exercise/index.html @@ -10,5 +10,6 @@
    npm test
    in the command line. + diff --git a/step2-07/demo/index.html b/step2-07/demo/index.html index 6025e9f..3bde031 100644 --- a/step2-07/demo/index.html +++ b/step2-07/demo/index.html @@ -6,5 +6,6 @@
    + diff --git a/step2-07/exercise/index.html b/step2-07/exercise/index.html index 6025e9f..3bde031 100644 --- a/step2-07/exercise/index.html +++ b/step2-07/exercise/index.html @@ -6,5 +6,6 @@
    + diff --git a/step2-08/demo/index.html b/step2-08/demo/index.html index 6025e9f..3bde031 100644 --- a/step2-08/demo/index.html +++ b/step2-08/demo/index.html @@ -6,5 +6,6 @@
    + diff --git a/step2-08/exercise/index.html b/step2-08/exercise/index.html index 6025e9f..3bde031 100644 --- a/step2-08/exercise/index.html +++ b/step2-08/exercise/index.html @@ -6,5 +6,6 @@
    + diff --git a/step2-09/demo/index.html b/step2-09/demo/index.html index 6025e9f..3bde031 100644 --- a/step2-09/demo/index.html +++ b/step2-09/demo/index.html @@ -6,5 +6,6 @@
    + diff --git a/step2-09/exercise/index.html b/step2-09/exercise/index.html index 6025e9f..3bde031 100644 --- a/step2-09/exercise/index.html +++ b/step2-09/exercise/index.html @@ -6,5 +6,6 @@
    + From 61d9cb35e6dd4e9e9ef7de62853f1c6b22522ada Mon Sep 17 00:00:00 2001 From: Ken Date: Mon, 25 Feb 2019 17:05:00 -0800 Subject: [PATCH 02/32] adding ghpage deploy --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index dba2296..23d57c7 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "build": "rimraf docs && webpack --progress --mode production", "start:server": "nodemon -w server server/index.js", "start": "run-p start:server start:client", - "static": "live-server --host=localhost" + "static": "live-server --host=localhost", + "deploy-ghpages": "git push origin :gh-pages && git subtree push --prefix docs origin gh-pages" }, "keywords": [], "author": "", From 3997173f45145d9fa050eaf710e339105d3c8d78 Mon Sep 17 00:00:00 2001 From: Ken Date: Mon, 25 Feb 2019 17:23:53 -0800 Subject: [PATCH 03/32] adding pipelines config for publishing docs --- azure-pipelines.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..ed29a15 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,26 @@ +# Node.js +# Build a general Node.js project with npm. +# Add steps that analyze code, save build artifacts, deploy, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript + +trigger: + - master + +pool: + vmImage: 'Ubuntu-16.04' + +steps: + - task: NodeTool@0 + inputs: + versionSpec: '10.x' + displayName: 'Install Node.js' + + - script: | + git remote set-url origin https://kenotron:$(git.pat)@github.com/Microsoft/frontend-bootcamp.git + npm install + git checkout -b build_$(Build.BuildId) + npm run build + git add docs/ + git commit -m "adding docs" + git push origin `git subtree split --prefix docs master`:gh-pages --force + displayName: 'npm install, build and push docs to gh-pages' From e0430a413cc278b9401271ed0373fb5985ce637e Mon Sep 17 00:00:00 2001 From: Ken Date: Mon, 25 Feb 2019 17:57:32 -0800 Subject: [PATCH 04/32] added a config for git --- azure-pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ed29a15..7393258 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -16,6 +16,8 @@ steps: displayName: 'Install Node.js' - script: | + git config user.email "kchau@microsoft.com" + git config user.name "Ken Chau" git remote set-url origin https://kenotron:$(git.pat)@github.com/Microsoft/frontend-bootcamp.git npm install git checkout -b build_$(Build.BuildId) From 743f332c5ccd9f84a0d7990f3f6190376336a424 Mon Sep 17 00:00:00 2001 From: Ken Date: Mon, 25 Feb 2019 18:05:49 -0800 Subject: [PATCH 05/32] get on master branch to do this work --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7393258..47bf220 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -19,6 +19,7 @@ steps: git config user.email "kchau@microsoft.com" git config user.name "Ken Chau" git remote set-url origin https://kenotron:$(git.pat)@github.com/Microsoft/frontend-bootcamp.git + git checkout master npm install git checkout -b build_$(Build.BuildId) npm run build From 8b3efdcd7783c791268b8c8ddc4767165fa65704 Mon Sep 17 00:00:00 2001 From: Ken Date: Mon, 25 Feb 2019 20:47:14 -0800 Subject: [PATCH 06/32] backtick escaping --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 47bf220..3df5785 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,5 +25,5 @@ steps: npm run build git add docs/ git commit -m "adding docs" - git push origin `git subtree split --prefix docs master`:gh-pages --force + "git push origin `git subtree split --prefix docs master`:gh-pages --force" displayName: 'npm install, build and push docs to gh-pages' From 73f5cb8b1954702e6f4084597e9cc5bba0cd2c66 Mon Sep 17 00:00:00 2001 From: Ken Date: Mon, 25 Feb 2019 20:52:53 -0800 Subject: [PATCH 07/32] get rid of quote again --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3df5785..47bf220 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,5 +25,5 @@ steps: npm run build git add docs/ git commit -m "adding docs" - "git push origin `git subtree split --prefix docs master`:gh-pages --force" + git push origin `git subtree split --prefix docs master`:gh-pages --force displayName: 'npm install, build and push docs to gh-pages' From e9dbc32fc58a908ff6d563083f65a0c31ee5fe25 Mon Sep 17 00:00:00 2001 From: Ken Date: Mon, 25 Feb 2019 20:55:51 -0800 Subject: [PATCH 08/32] gh-pages refs --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 47bf220..ce90c4b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,5 +25,5 @@ steps: npm run build git add docs/ git commit -m "adding docs" - git push origin `git subtree split --prefix docs master`:gh-pages --force + git push origin `git subtree split --prefix docs master`:refs/heads/gh-pages --force displayName: 'npm install, build and push docs to gh-pages' From 27747bfa9c9cfda416fc0fad1ba18d413fff4634 Mon Sep 17 00:00:00 2001 From: Ken Date: Mon, 25 Feb 2019 21:01:54 -0800 Subject: [PATCH 09/32] have it pull the latest --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ce90c4b..e507045 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,6 +20,7 @@ steps: git config user.name "Ken Chau" git remote set-url origin https://kenotron:$(git.pat)@github.com/Microsoft/frontend-bootcamp.git git checkout master + git pull npm install git checkout -b build_$(Build.BuildId) npm run build From 6ee37188f6a02846f960519b76e380a2d336a786 Mon Sep 17 00:00:00 2001 From: Ken Date: Mon, 25 Feb 2019 21:24:47 -0800 Subject: [PATCH 10/32] making a temp branch to do updates on the docs push --- azure-pipelines.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e507045..c9d64d4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -24,7 +24,8 @@ steps: npm install git checkout -b build_$(Build.BuildId) npm run build - git add docs/ + git add . git commit -m "adding docs" - git push origin `git subtree split --prefix docs master`:refs/heads/gh-pages --force + git subtree split --prefix docs -b temp_$(Build.BuildId) + git push origin temp_$(Build.BuildId):refs/heads/gh-pages --force displayName: 'npm install, build and push docs to gh-pages' From 0755ef17869edbac24690e01a2a05f088210e19d Mon Sep 17 00:00:00 2001 From: Ken Date: Mon, 25 Feb 2019 21:47:15 -0800 Subject: [PATCH 11/32] okay we're not doing pr builds right now --- azure-pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c9d64d4..d7a7af6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -3,6 +3,8 @@ # Add steps that analyze code, save build artifacts, deploy, and more: # https://docs.microsoft.com/azure/devops/pipelines/languages/javascript +pr: none + trigger: - master From 5044bd5f9d80570fb7aa984c2cfa2ab3d69c924e Mon Sep 17 00:00:00 2001 From: Rodger Jordas Date: Tue, 26 Feb 2019 13:49:38 +0800 Subject: [PATCH 12/32] Fix typos --- README.md | 4 ++-- index.html | 2 +- step1-01/js-demo/README.md | 6 +++--- step1-02/demo/README.md | 4 ++-- step1-03/demo/README.md | 8 ++++---- step1-04/demo/README.md | 8 ++++---- step1-06/demo/README.md | 12 ++++++------ step1-07/demo/README.md | 18 +++++++++--------- step2-01/README.md | 12 ++++++------ step2-01/demo/src/index.tsx | 2 +- step2-04/README.md | 4 ++-- 11 files changed, 40 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 0839ddf..1ef7156 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This repo is the content for a two day workshop focused on introducing you to th ## Who is this workshop for -This workshop starts as a very high level introduction to the core principles of the web: HTML, CSS and JavaScript. This section is targeted at new and experienced developers alike. The second day dives into more complex topics such as Typescript and state management within an application. The examples should be accessible to anyone, but you will get more out of the day if you have some foundational experience in programing or web technologies. +This workshop starts as a very high level introduction to the core principles of the web: HTML, CSS and JavaScript. This section is targeted at new and experienced developers alike. The second day dives into more complex topics such as TypeScript and state management within an application. The examples should be accessible to anyone, but you will get more out of the day if you have some foundational experience in programing or web technologies. ## Web Workshop Setup @@ -62,7 +62,7 @@ This workshop starts as a very high level introduction to the core principles of Demo and Exercises are combined -1. [Introduction to Typescript](step2-01) +1. [Introduction to TypeScript](step2-01) 2. [UI Fabric Component Library](step2-02) 3. [Theming and Styling](step2-03) 4. [Testing with Jest](step2-04) diff --git a/index.html b/index.html index 11baad6..0986473 100644 --- a/index.html +++ b/index.html @@ -83,7 +83,7 @@
  • -
  • -
  • +
  • + - -
  • -
  • -
  • +
  • + - -
  • -
  • -
  • +
  • + - -
  • -
  • -
  • +
  • + - -
  • - - -
    -
      -
    • -

      Day 2

      - Take your todo app to the next level with TypeScript, Fabric React, and Redux. -
    • -
    • -
    • +
    +
    +
    +
      +
    • +

      Day 2

      + Take your todo app to the next level with TypeScript, Fabric React, and Redux. +
    • +
    • + -
    - -
  • -
  • +
  • + - -
  • -
  • -
  • +
  • + - -
  • -
  • -
  • +
  • + - -
  • -
  • -
  • +
  • + - -
  • -
  • -
  • +
  • + - -
  • -
  • -
  • +
  • + - -
  • -
  • -
  • +
  • + - -
  • -
  • -
  • +
  • + - -
  • - - -
    -
      -
    • -

      Playground

      - Build your app here! -
    • -
    • Playground
    • -
    -
    - - - - \ No newline at end of file + + + +
    +
      +
    • +

      Playground

      + Build your app here! +
    • +
    • Playground
    • +
    +
    + + + From 0cd4c168113a3331317d5574a26d4a567c7e54b2 Mon Sep 17 00:00:00 2001 From: Micah Godbolt Date: Tue, 26 Feb 2019 09:17:33 -0800 Subject: [PATCH 27/32] Update README.md --- step1-02/demo/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/step1-02/demo/README.md b/step1-02/demo/README.md index 5bbc685..b3b8b52 100644 --- a/step1-02/demo/README.md +++ b/step1-02/demo/README.md @@ -41,7 +41,7 @@ As we saw in the previous demo, HTML elements can be used to describe different ### Updating the header -The header of our page is where most of the action is going to happen. First, lets give our page a title (Not the HTML tag), adding 'TODO' to our `h1`. Then we can add an input and button to our `addTodo` div. +The header of our page is where most of the action is going to happen. First, lets give our app a name, adding 'TODO' to our `h1`. Then we can add an input and button to our `addTodo` div. ```html From 212806fe9c73a6fb6d6f1b58ba617cd97a82c5b2 Mon Sep 17 00:00:00 2001 From: Micah Godbolt Date: Tue, 26 Feb 2019 09:18:45 -0800 Subject: [PATCH 28/32] Update README.md --- step1-02/demo/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/step1-02/demo/README.md b/step1-02/demo/README.md index b3b8b52..8b419ba 100644 --- a/step1-02/demo/README.md +++ b/step1-02/demo/README.md @@ -61,7 +61,7 @@ The navigation for this application is quite simple. We want users to be able to ### Adding styles -Now that we've got the top of our application scaffolded, we can add some of our styles in the head. +Now that we've got the top of our application scaffolded, we can add some styles in the head. ```html From 6953257aadb2290de59196431ece29507c1b70a1 Mon Sep 17 00:00:00 2001 From: Ken Date: Tue, 26 Feb 2019 09:35:56 -0800 Subject: [PATCH 29/32] Fixing tracking and fixing the playground link --- assets/track.js | 2 +- index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/track.js b/assets/track.js index f94f793..26f76d4 100644 --- a/assets/track.js +++ b/assets/track.js @@ -5,4 +5,4 @@ var appInsights=window.appInsights||function(a){ instrumentationKey: "6ad37ae0-c4ab-4739-925c-1e2773c31f17" }); // prettier-ignore -window.appInsights=appInsights,appInsights.queue&&0===appInsights.queue.length&&appInsights.trackPageView(); +window.appInsights=appInsights,appInsights.queue&&0===appInsights.queue.length&&appInsights.trackPageView(null, null, {urlReferrer: document.referrer}); diff --git a/index.html b/index.html index 0986473..35ca90b 100644 --- a/index.html +++ b/index.html @@ -161,7 +161,7 @@

    Playground

    Build your app here! -
  • Playground
  • +
  • Playground
  • From 9cef35ef706d730d0f35da1218850bfe902c2e24 Mon Sep 17 00:00:00 2001 From: Ken Date: Tue, 26 Feb 2019 09:45:41 -0800 Subject: [PATCH 30/32] fix links in readme and filter out localhost traffic --- README.md | 4 ++-- assets/track.js | 5 ++++- step2-09/README.md | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fe3e06d..6236408 100644 --- a/README.md +++ b/README.md @@ -82,8 +82,8 @@ Demo and Exercises are combined If you are interested in JavaScript, TypeScript, React, Redux, Design Systems, follow us on Twitter: -@kenneth_chau -@micahgodbolt +- [@kenneth_chau](https://twitter.com/kenneth_chau) +- [@micahgodbolt](https://twitter.com/micahgodbolt) # Contributing diff --git a/assets/track.js b/assets/track.js index 26f76d4..1c3cfda 100644 --- a/assets/track.js +++ b/assets/track.js @@ -4,5 +4,8 @@ var appInsights=window.appInsights||function(a){ }({ instrumentationKey: "6ad37ae0-c4ab-4739-925c-1e2773c31f17" }); + // prettier-ignore -window.appInsights=appInsights,appInsights.queue&&0===appInsights.queue.length&&appInsights.trackPageView(null, null, {urlReferrer: document.referrer}); +if (window.location.hostname !== 'localhost') { + window.appInsights=appInsights,appInsights.queue&&0===appInsights.queue.length&&appInsights.trackPageView(null, null, {urlReferrer: document.referrer}); +} diff --git a/step2-09/README.md b/step2-09/README.md index cda114a..71a1073 100644 --- a/step2-09/README.md +++ b/step2-09/README.md @@ -2,6 +2,8 @@ [Lessons](../) | [Exercise](./exercise/) | [Demo](./demo/) +(First off, this doesn't work with the live site on github.io. Clone this repo to try this step out) + Redux Thunk middleware for actions with service calls. The documentation is here: https://github.com/reduxjs/redux-thunk From 55cd2cffe8e7cdf4b8795779edb071c6456b128f Mon Sep 17 00:00:00 2001 From: Micah Godbolt Date: Tue, 26 Feb 2019 10:09:17 -0800 Subject: [PATCH 31/32] style tweak --- assets/shared.css | 4 ++-- index.html | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/assets/shared.css b/assets/shared.css index fa268f0..bc0d60a 100644 --- a/assets/shared.css +++ b/assets/shared.css @@ -67,10 +67,10 @@ h1 a { content: counter(steps); position: absolute; left: -20px; - bottom: -20px; + bottom: -3px; font-size: 220px; line-height: 188px; - color: #f3f2f1; + color: #eaeaea; z-index: 1; } diff --git a/index.html b/index.html index 0986473..c9dc707 100644 --- a/index.html +++ b/index.html @@ -4,6 +4,7 @@ + Microsoft Days in the Web - Welcome
    From d8702ec24e3bc849398f18a9b4e6878160915a1d Mon Sep 17 00:00:00 2001 From: Micah Godbolt Date: Tue, 26 Feb 2019 11:21:28 -0800 Subject: [PATCH 32/32] misc fixes --- README.md | 9 +++++---- assets/{track.js => scripts.js} | 0 index.html | 4 ++-- step1-01/html-demo/html-demo.html | 13 ++++++++++++- step1-01/index.html | 1 + step1-01/js-demo/js-demo-final.html | 2 +- step1-02/index.html | 16 ---------------- step1-03/index.html | 16 ---------------- step1-04/index.html | 15 --------------- step1-05/index.html | 15 --------------- step1-06/demo/README.md | 14 +++++++------- step1-06/demo/src/components/TodoFooter.tsx | 2 +- step1-06/demo/src/components/TodoList.tsx | 6 +++--- .../exercise/src/components/TodoHeader.tsx | 6 +++--- step1-06/final/src/components/TodoHeader.tsx | 8 ++++---- step1-07/demo/README.md | 4 ++++ step1-07/demo/src/TodoApp.tsx | 19 ++++++++++++++++++- step1-07/exercise/src/TodoApp.tsx | 19 ++++++++++++++++++- .../exercise/src/components/TodoHeader.tsx | 2 +- step1-07/final/src/components/TodoHeader.tsx | 2 +- step1-07/index.html | 15 --------------- step2-01/demo/index.html | 2 +- step2-01/exercise/index.html | 2 +- step2-02/demo/index.html | 2 +- step2-02/exercise/index.html | 2 +- step2-03/demo/index.html | 2 +- step2-03/exercise/index.html | 2 +- step2-04/demo/index.html | 2 +- step2-04/exercise/index.html | 2 +- step2-05/demo/index.html | 2 +- step2-05/exercise/index.html | 2 +- step2-06/demo/index.html | 2 +- step2-06/exercise/index.html | 2 +- step2-07/demo/index.html | 2 +- step2-07/exercise/index.html | 2 +- step2-08/demo/index.html | 2 +- step2-08/exercise/index.html | 2 +- step2-09/demo/index.html | 2 +- step2-09/exercise/index.html | 2 +- 39 files changed, 99 insertions(+), 125 deletions(-) rename assets/{track.js => scripts.js} (100%) delete mode 100644 step1-02/index.html delete mode 100644 step1-03/index.html delete mode 100644 step1-04/index.html delete mode 100644 step1-05/index.html delete mode 100644 step1-07/index.html diff --git a/README.md b/README.md index 6236408..bd7849c 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,8 @@ This workshop starts as a very high level introduction to the core principles of - Current version of [Node/NPM](https://nodejs.org/en/) - Install [Git](https://git-scm.com/downloads) - [VSCode Editor](https://code.visualstudio.com) -- Up to date browser with dev tools (some demos will be shown using Chrome) +- Up to date browser with React Developer Tools +- React Developer Tools: [Chrome](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en) or [Firefox](https://addons.mozilla.org/en-US/firefox/addon/react-devtools/) ### Getting Set Up @@ -48,13 +49,13 @@ This workshop starts as a very high level introduction to the core principles of - [Exercise](step1-03/exercise) 4. [React Introduction](step1-04) - [Demo](step1-04/demo) -5. [Thinking in React: Building a Static Page](step1-05) +5. [Building a Static Page](step1-05) - [Demo](step1-05/demo) - [Exercise](step1-05/exercise) -6. [Thinking in React: State Driven UI](step1-06) +6. [State Driven UI](step1-06) - [Demo](step1-06/demo) - [Exercise](step1-06/exercise) -7. [Thinking in React: UI Driven State](step1-07) +7. [Types & UI Driven State](step1-07) - [Demo](step1-07/demo) - [Exercise](step1-07/exercise) diff --git a/assets/track.js b/assets/scripts.js similarity index 100% rename from assets/track.js rename to assets/scripts.js diff --git a/index.html b/index.html index abddfc3..8400b40 100644 --- a/index.html +++ b/index.html @@ -67,7 +67,7 @@
  • Playground
  • - + diff --git a/step1-01/html-demo/html-demo.html b/step1-01/html-demo/html-demo.html index 2fe26b0..f15f393 100644 --- a/step1-01/html-demo/html-demo.html +++ b/step1-01/html-demo/html-demo.html @@ -13,7 +13,18 @@

    Document Meta Data

    -

    head, title, link, style

    +
    +    <head>
    +      <title>Intro to HTML</title>
    +      <link rel="stylesheet" href="./style.css" />
    +      
    +      <style>
    +        hr {
    +          margin: 40px;
    +        }
    +      </style>
    +    </head>
    +      

    diff --git a/step1-01/index.html b/step1-01/index.html index e46ae19..05c4cb9 100644 --- a/step1-01/index.html +++ b/step1-01/index.html @@ -15,5 +15,6 @@
    + diff --git a/step1-01/js-demo/js-demo-final.html b/step1-01/js-demo/js-demo-final.html index eb4eb17..ff57981 100644 --- a/step1-01/js-demo/js-demo-final.html +++ b/step1-01/js-demo/js-demo-final.html @@ -1,6 +1,6 @@ - +
    diff --git a/step1-02/index.html b/step1-02/index.html deleted file mode 100644 index a245e9e..0000000 --- a/step1-02/index.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - diff --git a/step1-03/index.html b/step1-03/index.html deleted file mode 100644 index a245e9e..0000000 --- a/step1-03/index.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - diff --git a/step1-04/index.html b/step1-04/index.html deleted file mode 100644 index dadfb94..0000000 --- a/step1-04/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - -
    - -
    - - diff --git a/step1-05/index.html b/step1-05/index.html deleted file mode 100644 index dadfb94..0000000 --- a/step1-05/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - -
    - -
    - - diff --git a/step1-06/demo/README.md b/step1-06/demo/README.md index 1722863..c82d7e5 100644 --- a/step1-06/demo/README.md +++ b/step1-06/demo/README.md @@ -71,10 +71,10 @@ I've already pulled out our props into `filter` and `todos` variables, and writt } ``` -- A JavaScript map takes in an array and transforms it into a new array -- We use the `id` from the `filterTodos` array as the [list key](https://reactjs.org/docs/lists-and-keys.html) to help React track each item as state changes. -- The key is not actually passed into the component, so we pass the key in as `id` as well. This will help us out later. -- Lastly we use the `id` to grab the todo from our `todos` object, then use the [spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax) to pass through the todo's `label` and `completed` values. +- **map**: A JavaScript map takes in an array (filteredTodos) and transforms it into a new array (our rendered TodoListItems) +- **key**: We use the `id` from the `filterTodos` array as the [list key](https://reactjs.org/docs/lists-and-keys.html) to help React track each item as state changes. +- **id**: The key is not actually passed into the component, so we pass the key in as `id` as well. This will help us out later. +- **todos[id]**: Lastly we use the `id` to grab the todo from our `todos` object, then use the [spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax) to pass through the todo's `label` and `completed` values. > This spread operator is the same as saying `label={todos[id].label} completed={todos[id].completed}`. Pretty obvious why spread is so handy! ### State Driven and Stateful Header @@ -87,9 +87,9 @@ In CSS based styling, visual states are applied by adding and removing classes. ```jsx ``` diff --git a/step1-06/demo/src/components/TodoFooter.tsx b/step1-06/demo/src/components/TodoFooter.tsx index c936963..ae4bf06 100644 --- a/step1-06/demo/src/components/TodoFooter.tsx +++ b/step1-06/demo/src/components/TodoFooter.tsx @@ -1,7 +1,7 @@ import React from 'react'; export const TodoFooter = (props: any) => { - const itemCount = Object.keys(props.todos).filter(id => !props.todos[id].completed).length; + // const itemCount = Object.keys(props.todos).filter(id => !props.todos[id].completed).length; return (
    4 items left diff --git a/step1-06/demo/src/components/TodoList.tsx b/step1-06/demo/src/components/TodoList.tsx index 29ca769..9f12d6d 100644 --- a/step1-06/demo/src/components/TodoList.tsx +++ b/step1-06/demo/src/components/TodoList.tsx @@ -5,9 +5,9 @@ export class TodoList extends React.Component { render() { const { filter, todos } = this.props; - const filteredTodos = Object.keys(todos).filter(id => { - return filter === 'all' || (filter === 'completed' && todos[id].completed) || (filter === 'active' && !todos[id].completed); - }); + // const filteredTodos = Object.keys(todos).filter(id => { + // return filter === 'all' || (filter === 'completed' && todos[id].completed) || (filter === 'active' && !todos[id].completed); + // }); return (
      diff --git a/step1-06/exercise/src/components/TodoHeader.tsx b/step1-06/exercise/src/components/TodoHeader.tsx index 51830e9..e8fde78 100644 --- a/step1-06/exercise/src/components/TodoHeader.tsx +++ b/step1-06/exercise/src/components/TodoHeader.tsx @@ -17,9 +17,9 @@ export class TodoHeader extends React.Component {
    ); diff --git a/step1-06/final/src/components/TodoHeader.tsx b/step1-06/final/src/components/TodoHeader.tsx index 17a8b3e..f606f4a 100644 --- a/step1-06/final/src/components/TodoHeader.tsx +++ b/step1-06/final/src/components/TodoHeader.tsx @@ -5,7 +5,7 @@ export class TodoHeader extends React.Component { super(props); this.state = { labelInput: '' }; } - + render() { const { filter } = this.props; @@ -17,9 +17,9 @@ export class TodoHeader extends React.Component { ); diff --git a/step1-07/demo/README.md b/step1-07/demo/README.md index 0222dd5..7a2d569 100644 --- a/step1-07/demo/README.md +++ b/step1-07/demo/README.md @@ -160,8 +160,12 @@ const { label, completed, complete, id } = this.props; And then use the input's `onChange` event to fire our `complete` callback. We can see in the signature that we expect and `id` of type string, so we'll pass our `id` prop in. +> A [callback function](https://developer.mozilla.org/en-US/docs/Glossary/Callback_function) is a function passed into a component as a prop + ```tsx complete(id)} /> ``` > Note that the function param and prop name just happen to be the same. This isn't required. + +Now that our todos are firing the `onChange` callback, give them a click and take look at how the app response. Since our footer text is driven off of the number of unchecked todos, the footer will automatically update to reflect the new state. diff --git a/step1-07/demo/src/TodoApp.tsx b/step1-07/demo/src/TodoApp.tsx index bfcbe22..7c67e87 100644 --- a/step1-07/demo/src/TodoApp.tsx +++ b/step1-07/demo/src/TodoApp.tsx @@ -10,7 +10,24 @@ export class TodoApp extends React.Component { constructor(props) { super(props); this.state = { - todos: {}, + todos: { + '04': { + label: 'Todo 4', + completed: true + }, + '03': { + label: 'Todo 3', + completed: false + }, + '02': { + label: 'Todo 2', + completed: false + }, + '01': { + label: 'Todo 1', + completed: false + } + }, filter: 'all' }; } diff --git a/step1-07/exercise/src/TodoApp.tsx b/step1-07/exercise/src/TodoApp.tsx index b24da27..c8ec119 100644 --- a/step1-07/exercise/src/TodoApp.tsx +++ b/step1-07/exercise/src/TodoApp.tsx @@ -10,7 +10,24 @@ export class TodoApp extends React.Component { } _onFilter = evt => { - this.props.setFilter(evt.target.textContet); + this.props.setFilter(evt.target.innerText); }; _onChange = evt => { diff --git a/step1-07/final/src/components/TodoHeader.tsx b/step1-07/final/src/components/TodoHeader.tsx index d1f18e3..9526319 100644 --- a/step1-07/final/src/components/TodoHeader.tsx +++ b/step1-07/final/src/components/TodoHeader.tsx @@ -44,7 +44,7 @@ export class TodoHeader extends React.Component { - this.props.setFilter(evt.target.textContet); + this.props.setFilter(evt.target.innerText); }; _onChange = evt => { diff --git a/step1-07/index.html b/step1-07/index.html deleted file mode 100644 index dadfb94..0000000 --- a/step1-07/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - -
    - -
    - - diff --git a/step2-01/demo/index.html b/step2-01/demo/index.html index 51959a8..b0857bf 100644 --- a/step2-01/demo/index.html +++ b/step2-01/demo/index.html @@ -8,6 +8,6 @@
    Nothing to show here, just look at your console window for output. Hit F12 to open console window.
    - + diff --git a/step2-01/exercise/index.html b/step2-01/exercise/index.html index 51959a8..b0857bf 100644 --- a/step2-01/exercise/index.html +++ b/step2-01/exercise/index.html @@ -8,6 +8,6 @@
    Nothing to show here, just look at your console window for output. Hit F12 to open console window.
    - + diff --git a/step2-02/demo/index.html b/step2-02/demo/index.html index 3bde031..ab43ffe 100644 --- a/step2-02/demo/index.html +++ b/step2-02/demo/index.html @@ -6,6 +6,6 @@
    - + diff --git a/step2-02/exercise/index.html b/step2-02/exercise/index.html index 3bde031..ab43ffe 100644 --- a/step2-02/exercise/index.html +++ b/step2-02/exercise/index.html @@ -6,6 +6,6 @@
    - + diff --git a/step2-03/demo/index.html b/step2-03/demo/index.html index 3bde031..ab43ffe 100644 --- a/step2-03/demo/index.html +++ b/step2-03/demo/index.html @@ -6,6 +6,6 @@
    - + diff --git a/step2-03/exercise/index.html b/step2-03/exercise/index.html index 3bde031..ab43ffe 100644 --- a/step2-03/exercise/index.html +++ b/step2-03/exercise/index.html @@ -6,6 +6,6 @@
    - + diff --git a/step2-04/demo/index.html b/step2-04/demo/index.html index f6ea247..50d9fb4 100644 --- a/step2-04/demo/index.html +++ b/step2-04/demo/index.html @@ -10,6 +10,6 @@
    npm test
    in the command line. - + diff --git a/step2-04/exercise/index.html b/step2-04/exercise/index.html index f6ea247..50d9fb4 100644 --- a/step2-04/exercise/index.html +++ b/step2-04/exercise/index.html @@ -10,6 +10,6 @@
    npm test
    in the command line. - + diff --git a/step2-05/demo/index.html b/step2-05/demo/index.html index f6ea247..50d9fb4 100644 --- a/step2-05/demo/index.html +++ b/step2-05/demo/index.html @@ -10,6 +10,6 @@
    npm test
    in the command line. - + diff --git a/step2-05/exercise/index.html b/step2-05/exercise/index.html index f6ea247..50d9fb4 100644 --- a/step2-05/exercise/index.html +++ b/step2-05/exercise/index.html @@ -10,6 +10,6 @@
    npm test
    in the command line. - + diff --git a/step2-06/demo/index.html b/step2-06/demo/index.html index f6ea247..50d9fb4 100644 --- a/step2-06/demo/index.html +++ b/step2-06/demo/index.html @@ -10,6 +10,6 @@
    npm test
    in the command line. - + diff --git a/step2-06/exercise/index.html b/step2-06/exercise/index.html index f6ea247..50d9fb4 100644 --- a/step2-06/exercise/index.html +++ b/step2-06/exercise/index.html @@ -10,6 +10,6 @@
    npm test
    in the command line. - + diff --git a/step2-07/demo/index.html b/step2-07/demo/index.html index 3bde031..ab43ffe 100644 --- a/step2-07/demo/index.html +++ b/step2-07/demo/index.html @@ -6,6 +6,6 @@
    - + diff --git a/step2-07/exercise/index.html b/step2-07/exercise/index.html index 3bde031..ab43ffe 100644 --- a/step2-07/exercise/index.html +++ b/step2-07/exercise/index.html @@ -6,6 +6,6 @@
    - + diff --git a/step2-08/demo/index.html b/step2-08/demo/index.html index 3bde031..ab43ffe 100644 --- a/step2-08/demo/index.html +++ b/step2-08/demo/index.html @@ -6,6 +6,6 @@
    - + diff --git a/step2-08/exercise/index.html b/step2-08/exercise/index.html index 3bde031..ab43ffe 100644 --- a/step2-08/exercise/index.html +++ b/step2-08/exercise/index.html @@ -6,6 +6,6 @@
    - + diff --git a/step2-09/demo/index.html b/step2-09/demo/index.html index 3bde031..ab43ffe 100644 --- a/step2-09/demo/index.html +++ b/step2-09/demo/index.html @@ -6,6 +6,6 @@
    - + diff --git a/step2-09/exercise/index.html b/step2-09/exercise/index.html index 3bde031..ab43ffe 100644 --- a/step2-09/exercise/index.html +++ b/step2-09/exercise/index.html @@ -6,6 +6,6 @@
    - +