adding back docs

This commit is contained in:
Ken
2019-02-22 20:25:09 -08:00
parent 78368cdf39
commit f70417f6ae
166 changed files with 4344 additions and 516 deletions

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

BIN
docs/assets/flux.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@@ -16,22 +16,16 @@
<h2>Day 1</h2>
Setup, HTML, CSS, Javascript and Intro to React
</li>
<li class="Tile">
<a target="_blank" href="./step1-00/" class="Tile-link">
Step 0 <br />
HTML/CSS/JS
</a>
</li>
<li class="Tile">
<a target="_blank" href="./step1-01/" class="Tile-link">
Step 1 <br />
Todo HTML
HTML/CSS/JS
</a>
</li>
<li class="Tile">
<a target="_blank" href="./step1-02/" class="Tile-link">
Step 2 <br />
Todo CSS
Todo HTML & CSS
</a>
</li>
<li class="Tile">

View File

@@ -2,5 +2,5 @@
<html>
<body>
<div id="app"></div>
<script type="text/javascript" src="../playground/playground.js"></script></body>
<script src="../playground/playground.js"></script></body>
</html>

View File

@@ -1,17 +0,0 @@
<html>
<head>
<link rel="stylesheet" href="../assets/shared.css" />
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/9.6.1/css/fabric.min.css" />
</head>
<body class="ms-Fabric">
<div class="Container">
<ul class="Tiles">
<li class="Tile"><a href="./html-demo/html-demo.html" class="Tile-link">HTML Demo</a></li>
<li class="Tile"><a href="./css-demo/css-demo.html" class="Tile-link">CSS Demo</a></li>
<li class="Tile"><a href="./css-demo/css-demo-finished.html" class="Tile-link">CSS Demo Finished</a></li>
<li class="Tile"><a href="./js-demo/js-demo.html" class="Tile-link">JS Demo</a></li>
</ul>
</div>
</body>
</html>

23
docs/step1-01/README.md Normal file
View File

@@ -0,0 +1,23 @@
## How the Web Works
A simple web page is rendered on the screen via the following steps
> There are many sub steps in this process
> but these are the highlights
1. You instruct the browser which webpage you'd like to see
2. The browser looks up the site in a 'DNS Server'
- This is like a big phone book for website server addresses
3. The browser asks the server to send over a specific page of the website `developer.mozilla.org/filename.html` or `developer.mozilla.org`
- If asked for a 'root' level address, most servers will return `'root'/index.html`
4. The server sends the HTML file back to the browser
5. The browser starts to read the HTML file from the top to the bottom, \*stopping any time that additional resources are required
- CSS stylesheets
- JavaScript files
- Fonts
- Images
6. Browser makes requests for additional resources
- Those resources might request even more files
7. Once the browser gets to the bottom of the page it can start rendering, and then load the page
![MDN Page Load](https://user-images.githubusercontent.com/1434956/53033758-9da8d580-3426-11e9-9ab8-09f42ccab9a8.png)

View File

@@ -0,0 +1,127 @@
## CSS Demo
### CSS Properties
Now that we've gone over adding HTML tags to the page, lets cover adding styles to those tags. We can do quite a lot with styles! We can change:
- Typography
- Colors
- Appearance (Corners, Borders, Decorations)
- Layout
- Position
- Inline vs Block
- Animations
- and [many more](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference)
CSS is always applied in `property: value` pairs, like `background: blue;` and are terminated with a semi colon.
### Applying CSS to an HTML file
CSS can be applied to HTML tags in three different ways.
1. Inline - Styles are applied directly to the HTML tag
- `<div style="background: blue; color: white;">Hello </div>`
2. Via a `<style>` tag in the HTML page
3. Through an externally loaded CSS file
- `<link rel="stylesheet" href="./css-demo-finished.css" />`
### Targeting specific HTML tags
Inline styles are always applied directly to the element you place them on, style tags and external CSS files need a method for matching HTML elements with their prospective style sets. We call these "selectors", and they are just as important to learn as the properties/values themselves. Below are a series of selectors and property/value combinations that we'll apply to our CSS Demo page
```css
/* Targeting the entire page */
body {
font: 1.2em sans-serif;
}
/* Targeting an HTML tag */
h1 {
/* Color name */
color: black;
/* 6 digit hex */
background: #ababab;
/* Margin: property for each side */
margin-bottom: 15px;
margin-top: 15px;
/* Shorthand: Padding applies to all sides */
padding: 10px;
/* 3 digit hex and border shorthand */
border: 1px solid #ddd;
}
/* Overriding inherited styles */
span {
color: #004578;
}
/* Targeting a class name */
.tiles {
display: flex;
}
/* Decendant selector */
.tiles img {
width: 100%;
}
/* Direct decendant selector */
.tiles > div {
/* rgb colors */
background: rgb(10, 10, 10);
color: white;
flex-basis: 100%;
/* Longhand goes clockwise from top
10px - all
10px 20px - top/bottom left/right
10px 20px 15px - top left/right bottom
*/
padding: 10px 20px 15px;
margin: 10px 20px 10px 0;
}
/* Qualified selector */
div.links {
background: #004578;
}
/* Style inheritance only works for unstyled elements */
a {
color: white;
}
/* Pseudo hover selector */
a:hover {
color: #ccc;
}
/* Sibling selectors */
a ~ a {
/* Changing elements from inline to block */
display: block;
}
/* Positional Pseudo Selectors */
.tiles > div:last-child {
/* overrides margin-right but leaves other margins alone */
margin-right: 0;
}
/* ID selector */
#contact-form {
display: flex;
flex-direction: column;
}
/* Attribute selector */
input[type='submit'] {
margin-top: 10px;
}
```

View File

@@ -1,5 +1,4 @@
/* https://developer.mozilla.org/en-US/docs/Learn/CSS/Introduction_to_CSS/Combinators_and_multiple_selectors */
/* Targeting an HTML tag */
body {
font: 1.2em sans-serif;
}

View File

@@ -0,0 +1,63 @@
/* https://developer.mozilla.org/en-US/docs/Learn/CSS/Introduction_to_CSS/Combinators_and_multiple_selectors */
/* body {
font: 1.2em sans-serif;
} */
/* h1 {
color: black;
background: #ababab;
margin-bottom: 15px;
margin-top: 15px;
padding: 10px;
border: 1px solid #ddd;
} */
/* span {
color: #004578;
} */
/* .tiles {
display: flex;
} */
/* .tiles img {
width: 100%;
} */
/* .tiles > div {
background: rgb(10, 10, 10);
color: white;
flex-basis: 100%;
padding: 10px 20px 15px;
margin: 10px 20px 10px 0;
} */
/* div.links {
background: #004578;
} */
/* a {
color: white;
} */
/* a:hover {
color: #ccc;
} */
/* a ~ a {
display: block;
} */
/* .tiles > div:last-child {
margin-right: 0;
} */
/* #contact-form {
display: flex;
flex-direction: column;
} */
/* input[type='submit'] {
margin-top: 10px;
} */

View File

@@ -0,0 +1,71 @@
## HTML Demo
The [HTML demo page](http://localhost:8080/step1-00/html-demo/html-demo.html) is a large collection of HTML elements that you will come across during development. The full list of elements can be found on [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element).
To learn more about each element, click on the elements below.
### [Document Meta Data](https://developer.mozilla.org/en-US/docs/Web/HTML/Element#Document_metadata)
- [html](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html) - Root level element
- [head](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head) - Provides general information (meta-data) about the page
- [title](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/title) - Defines document title shown via browser tab
- [link](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link) - Links to external resource (usually stylesheets)
- [style](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style) - Inline style tag
### [Content Sectioning](https://developer.mozilla.org/en-US/docs/Web/HTML/Element#Content_sectioning)
- [section](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/section) - Generic section of content
- [header](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/header) - Introductory content or navigational aid
- [footer](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/footer) - Footer for nearest sectioning element
- [main](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/main) - Dominent content
- [nav](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/nav) - Navigational aid
- [article](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/article) - Syndicated content
- [aside](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/aside) - Related information
- [h1,h2,h3,h4,h5,h6](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements) - Section headings
### [Block Text Content](https://developer.mozilla.org/en-US/docs/Web/HTML/Element#Text_content)
- [div](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div) - A generic block level container
- [p](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/p) - A paragraph
- [ol](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ol) - Ordered list (1,2,3)
- [ul](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ul) - Unordered list
- [li](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li) - List item
- [pre](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/pre) - Preformatted text
### [Inline Text Elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element#Inline_text_semantics)
- [a](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) - Anchor element for creating links to other pages, files, email
- [span](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span) - Generic inline container
- [b](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/b) - Bring attention to content
- [em](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/em) - Stress emphasis
- [i](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/i) - Range of text set off from normal text
- [sub](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sub) - Subscript text
- [sup](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sup) - Superscript text
- [code](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/code) - Fragment of computer code (monospace)
### [Image and multimedia](https://developer.mozilla.org/en-US/docs/Web/HTML/Element#Inline_text_semantics)
- [img](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img) - Embeds image into document
### [Table Content](https://developer.mozilla.org/en-US/docs/Web/HTML/Element#Table_content)
- [table](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table) - Root table container
- [thead](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/thead) - Table head container
- [tr](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tr) - Table row
- [th](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/th) - Table head cell
- [tbody](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody) - Table body container
- [td](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/td) - Normal table cell
### [Forms](https://developer.mozilla.org/en-US/docs/Web/HTML/Element#Forms)
- [form](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form) - Form container
- [label](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label) - Label text for form elements
- [select](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select) - A dropdown container
- [option](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option) - Dropdown elements
- [input](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) - A form field to collect various inputs. Types include:
- text
- checkbox
- color
- date
- radio
- submit

View File

@@ -126,6 +126,10 @@
<h3>Inline style tags</h3>
<p><b>b tag</b> <em>em tag</em> <i>i tag</i> <sub>sub tag</sub> <sup>sup tab</sup> <code>code tag</code></p>
<div>
<img src="../../assets/fabric.jpg" width="100" />
</div>
</section>
<hr />
<section>

View File

@@ -1,27 +1,18 @@
<!DOCTYPE html>
<html>
<body>
<h1>todos</h1>
<div><input placeholder="add todo" /><button>Add</button></div>
<div>
<button>all</button>
<button>active</button>
<button>completed</button>
<head>
<link rel="stylesheet" href="../assets/shared.css" />
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/9.6.1/css/fabric.min.css" />
</head>
<body class="ms-Fabric">
<div class="Container">
<ul class="Tiles">
<li class="Tile"><a href="./html-demo/html-demo.html" class="Tile-link">HTML Demo</a></li>
<li class="Tile"><a href="./css-demo/css-demo.html" class="Tile-link">CSS Demo</a></li>
<li class="Tile"><a href="./css-demo/css-demo-finished.html" class="Tile-link">CSS Demo Finished</a></li>
<li class="Tile"><a href="./js-demo/js-demo.html" class="Tile-link">JS Demo</a></li>
<li class="Tile"><a href="./js-demo/js-demo-finished.html" class="Tile-link">JS Demo Finished</a></li>
</ul>
</div>
<ul>
<li>
<label><input type="checkbox" /> Todo 1</label>
</li>
<li>
<label><input type="checkbox" /> Todo 2</label>
</li>
<li>
<label><input type="checkbox" /> Todo 3</label>
</li>
<li>
<label><input type="checkbox" /> Todo 4</label>
</li>
</ul>
<div><span>4 items left</span> <button>Clear Completed</button></div>
</body>
</html>

View File

@@ -0,0 +1,116 @@
## JavaScript Demo
It's entirely possible to create a website with nothing but HTML and CSS, but as soon as you want user interaction other than links and forms, you'll need to reach for JavaScript, the scripting language of the web. Fortunately, JavaScript has grown up quite a bit since it was introduced in the 90s, and now runs just about everything: web applications, mobile applications, native applications, servers, robots and rocket ships.
In this demo we are going to cover a few of the core basics of the language that will help us when we start writing our TODO app. At the end of this demo we will be able to display the number of the letter 'a's in our email input.
We'll be covering:
- Variables
- Functions
- Conditionals
- Loops
- Interacting with the DOM (Document Object Model)
### Variables
Javascript is a loosly typed language. We can create a new variable with the keywords `var, let, const` and use them within our application. These variables can contain one of the following types of values:
1. boolean
2. number
3. string
4. array
5. object
Because they are not strongly typed, we can switch a varible from a number, to a string, to an array anytime we want to. In practice, this is a bit of an anti-pattern, as it makes debugging and refactoring extremely difficult. This is why we write just about every project in [Typescript](https://www.typescriptlang.org/).
Lets start off our demo by adding some variables to our [script tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)
```js
const match = 'a';
let matches = 0;
```
### Functions
Functions are resuable pieces of functionality. Functions can take inputs (parameters), and return values. Functions can be called from within your program, from within other functions, or invoked from within the DOM itself.
In our example we'll create a function called displayMatches (camelCase is typical for functions) and we'll invoke this function anytime that our submit button is clicked. For now we'll simply call a console log (a function that prints values to the browser console);
```html
<input onclick="displayMatches()" class="submit" value="Submit" type="submit" />
```
```js
function displayMatches() {
console.log("I'm Clicked");
}
```
### Iteration
Next up we are going to iterate through a string of text, and find all of the 'a' characters in the list. We don't yet have that string, so we'll use a fill in for now. Once we have our `email` variable we can loop over it with the [`for of`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of) loop syntax.
```js
function displayMatches() {
const text = 'abcda';
for (let letter of text) {
console.log(letter);
}
}
```
### Conditionals
Next we want to compare each `letter` with our `match` value, and if they are the same, we will increment our matches variable. Notice that `match` is a const and `matches` is a let because we expected `matches` to change over time. Remember that `letter = match` would set the `letter` variable to the value in `match`, so we use `==`, equality operator, and `===` strict equality operator, to make these comparisons.
> ("1" == 1) is true whereas ("1" === 1) would be false
```js
function displayMatches() {
const text = 'abcda';
for (let letter of text) {
if (letter === match) {
matches++;
}
}
console.log(matches);
}
```
### Interacting with the DOM
Now that we have a function performing all of our logic, it's time to connect this to our DOM by using some of the browsers built in functions.
First we need to get a reference to the email field in our app. To do this, I've added an `id` to the input, and we will call one of JavaScripts oldest methods (IE 5.5), getElementyId, which we find on the browser provided `document` global variable. This function will return a reference to that input, and we can store it in the `email` variable.
```js
const email = document.getElementById('email');
console.log(email);
```
And since what we're actually after is the "value" of the input field, we can set our `text` variable to the string assigned to the "value" key. To see this in action. Right click on the console message created by the code above, choose "save as variable" and then type `variableName.value`.
```js
const text = email.value;
```
#### Returning the values to the DOM
Now that we've read values from the DOM, and fed that into our matching logic, we are ready to return that number to our app. To do this we first need to grab a reference to our submit button, and since this button has no `id` we are going to use the more modern (IE8) `querySelector` to get it. This function takes any valid CSS selector and returns the first found match.
```js
const submit = document.querySelector('.submit');
```
Now that we have a reference to the submit input, we can set its value to a new value.
```js
submit.value = matches + ' matches';
```
If you are curious, we could have done this in a single line by chaining these methods and keys together:
```js
document.querySelector('.submit').value = matches + ' matches';
```

View File

@@ -1,5 +1,7 @@
<html>
<head> </head>
<head>
<link rel="stylesheet" href="../css-demo/css-demo-finished.css" />
</head>
<body>
<div>
<h1>This is my <span>Title</span></h1>
@@ -17,7 +19,7 @@
<div>
<h2>Contact Us</h2>
<div id="contact-form">
<label>Email</label><input class="email" type="email" />
<label>Email</label><input id="email" type="email" />
<input onclick="displayMatches()" class="submit" value="Submit" type="submit" />
</div>
</div>
@@ -29,13 +31,15 @@
let matches = 0;
function displayMatches() {
const text = document.querySelector('.email').value;
const email = document.getElementById('email');
const text = email.value;
for (let letter of text) {
if (letter === match) {
matches++;
}
}
document.querySelector('.submit').value = matches + ' matches';
const submit = document.querySelector('.submit');
submit.value = matches + ' matches';
}
</script>
</html>

View File

@@ -0,0 +1,30 @@
<html>
<head>
<link rel="stylesheet" href="../css-demo/css-demo-finished.css" />
</head>
<body>
<div>
<h1>This is my <span>Title</span></h1>
<div class="tiles">
<div class="links">
<h2>Important Links</h2>
<a href="#">We're Awesome</a>
<a href="#">Learn More</a>
<a href="#">Hire Us</a>
</div>
<div>
<h2>Our Logo</h2>
<img src="../../assets/fabric.jpg" width="100" alt="fabric logo" />
</div>
<div>
<h2>Contact Us</h2>
<div id="contact-form">
<label>Email</label><input class="email" type="email" />
<input class="submit" value="Submit" type="submit" />
</div>
</div>
</div>
</div>
</body>
<script></script>
</html>

95
docs/step1-02/README.md Normal file
View File

@@ -0,0 +1,95 @@
## HTML and CSS
Every website, application, form or component starts with markup. The HTML will change over time as you develop, but a first pass helps you understand the UI you are trying to build.
## Demo
In this exercise we will scaffold out some HTML for out Todo app, and add some basic styling to it.
### Page scaffold
```html
<!DOCTYPE html>
<html>
<head></head>
<body></body>
</html>
```
1. The DOCTYPE tells the browser that this file is written in modern HTML.
2. The HTML tag wraps the entire page, and is the page root. Nothing is placed outside of those tags. Attributes can be set on HTML
3. Head will contain all of the page's meta data, in this case a link to our css file
4. Body is where all of the visible content should be placed.
### Content Sectioning
As we saw in the previous demo, HTML elements can be used to describe different content sections of the applications. Let's add `header`, `main` and `footer`, as well as populate the header with an `h1`, addTodo div, and `nav` for our filters.
```html
<body>
<header>
<h1></h1>
<div class="addTodo"></div>
<nav></nav>
<header>
<main class="filter"></main>
<footer></footer>
</body>
```
> Note that a `form` element would have been more semantic than a `div`, but we aren't using this form to POST to a server, so for this example a div is easier to use.
### 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, adding 'TODO' to our `h1`. Then we can add an input and button to our `addTodo` div.
```html
<input class="textfield" placeholder="add todo" /> <button class="submit">Add</button>
```
#### Navigation
The navigation for this application is quite simple. We want users to be able to switch between three filtered states. Since we need to track which state is currently selected, we'll add that as a class on the first item.
```html
<nav class="filter">
<button class="selected">all</button>
<button>active</button>
<button>completed</button>
</nav>
```
### Adding styles
Now that we've got the top of our application scaffolded, we can add some our styles in the head.
```html
<head>
<link rel="stylesheet" href="./style.css" />
</head>
```
### Updating styles
It looks like the selected button isn't getting any special styles. Let's dig in and see why that is.
Open up the browser inspector and target our 'all' button. You'll notice that the blue style is present on the list, but it is being overriden by the `border: none` above it. This is a situation where specificity is winning out over the cascade.
> **Cascade** states that if two selectors are equal, the lowest one on the page wins
> **Specificity** states that regardless of cascade, the selector with the highest specificity wins
To fix this problem we need to either reduce the specificity of our button styles, or increase the specificity of the selected style. In this situation we will add `.filter` in front of the `.selected` selector, because the selected style only applies to the filter anyway.
## Exercise
1. Add an unordered list with class `todos` to the main section
2. Add 4 list items with class `todo` inside of that list with the following content
`<label><input type="checkbox" /> <span class="title"> Todo </span> </label>`
3. Add a span and a button to your footer
4. Span content should be `4 items left` and button should say `Clear Completed` and have a class of `submit`
5. Go into the CSS file and add `display: flex` to the footer. Also add `flex-grow:1` to the span inside of the footer
> Hint: Look back at the CSS demo to see the various ways you can use selectors to target existing HTML
> There are many strategies for creating and organizing class names in a large application. This lesson is focused on using CSS selectors, not the optimized way to scale your CSS.

View File

@@ -0,0 +1,41 @@
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
width: 400px;
margin: 20px auto;
}
h1 {
text-align: center;
}
.addTodo {
display: flex;
}
.textfield {
flex-grow: 1;
margin-right: 10px;
}
.submit {
border: none;
padding: 5px 10px;
}
.filter {
margin: 10px 0 0;
}
.filter button {
background: transparent;
border: none;
}
.selected {
border-bottom: 2px solid blue;
}
.todos {
list-style: none;
padding: 0;
}

View File

@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<header>
<h1>todos</h1>
<div class="addTodo">
<input class="textfield" placeholder="add todo" />
<button class="submit">Add</button>
</div>
<nav class="filter">
<button class="selected">all</button>
<button>active</button>
<button>completed</button>
</nav>
</header>
<main></main>
<footer></footer>
</body>
</html>

View File

@@ -0,0 +1,41 @@
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
width: 400px;
margin: 20px auto;
}
h1 {
text-align: center;
}
.addTodo {
display: flex;
}
.textfield {
flex-grow: 1;
margin-right: 10px;
}
.submit {
border: none;
padding: 5px 10px;
}
.filter {
margin: 10px 0 0;
}
.filter button {
background: transparent;
border: none;
}
.filter .selected {
border-bottom: 2px solid blue;
}
.todos {
list-style: none;
padding: 0;
}

View File

@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<header>
<h1>todos</h1>
<div class="addTodo">
<input class="textfield" placeholder="add todo" />
<button class="submit">Add</button>
</div>
<nav class="filter">
<button class="selected">all</button>
<button>active</button>
<button>completed</button>
</nav>
</header>
<main>
<ul class="todos">
<li class="todo">
<label><input type="checkbox" /> <span class="title"> Todo 1 </span> </label>
</li>
<li class="todo">
<label><input type="checkbox" /> <span class="title"> Todo 2 </span> </label>
</li>
<li class="todo">
<label><input type="checkbox" /> <span class="title"> Todo 3 </span> </label>
</li>
<li class="todo">
<label><input type="checkbox" /> <span class="title"> Todo 4 </span> </label>
</li>
</ul>
</main>
<footer><span>4 items left</span> <button class="submit">Clear Completed</button></footer>
</body>
</html>

View File

@@ -3,19 +3,21 @@ body {
width: 400px;
margin: 20px auto;
}
h1 {
text-align: center;
}
.addTodo {
display: flex;
}
.textfield {
width: 80%;
flex-grow: 1;
margin-right: 10px;
}
.add {
margin-left: 5%;
}
.button {
.submit {
border: none;
padding: 5px 10px;
}
@@ -28,6 +30,7 @@ h1 {
background: transparent;
border: none;
}
.filter .selected {
border-bottom: 2px solid blue;
}

View File

@@ -1,28 +1,16 @@
<!DOCTYPE html>
<html>
<link rel="stylesheet" href="./style.css" />
<body>
<h1>todos</h1>
<input class="textfield" placeholder="add todo" /><button class="button add">Add</button>
<div class="filter">
<button class="selected">all</button>
<button>active</button>
<button>completed</button>
<head>
<link rel="stylesheet" href="../assets/shared.css" />
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/9.6.1/css/fabric.min.css" />
</head>
<body class="ms-Fabric">
<div class="Container">
<ul class="Tiles">
<li class="Tile"><a href="./demo/index.html" class="Tile-link">Demo Start</a></li>
<li class="Tile"><a href="./exercise/index.html" class="Tile-link">Exercise Start</a></li>
<li class="Tile"><a href="./final/index.html" class="Tile-link">Final</a></li>
</ul>
</div>
<ul class="todos">
<li class="todo">
<label><input type="checkbox" /> Todo 1</label>
</li>
<li class="todo">
<label><input type="checkbox" /> Todo 2</label>
</li>
<li class="todo">
<label><input type="checkbox" /> Todo 3</label>
</li>
<li class="todo">
<label><input type="checkbox" /> Todo 4</label>
</li>
</ul>
<footer><span>4 items left</span> <button class="button">Clear Completed</button></footer>
</body>
</html>

61
docs/step1-03/README.md Normal file
View File

@@ -0,0 +1,61 @@
# Javascript Demo
Now that we a UI that looks like a todo app, we need to add functionality to make it **function** like a todo app. In this example we are going to use raw Javascript explicitly modify our application as we interact with it. This will be in stark contrast to the implicit approach we will take when we do this with React in the next exercise.
> Keep an eye on how often user actions directly modify the HTML on the page. You'll see this number drop to zero when we start using React.
## Demo
This demo starts off with a few elements already in place. Let's walk through what's already here.
- **clearInput()** - This is a generic, reusable function that takes in a `selector` paramater, finds the first matching element, and sets the element's value to an empty string. This direct modification is called a side effect.
- **getTodoText()** - This is a quick helper function that returns the value inside of our textfield. Notice how some functions return values and how you can set that return to a variable.
- **addTodo()** - This is the primary logic of our todo app. Here's how the lines break down.
1. `todo` is set to equal the first todo item
2. `newTodo` is a clone of todo. Passing true means it is a deep clone, so we get the todo's children as well. Cloning does not duplicate the DOM node. We'll need to insert it in step 4
3. We set the innerText of the `<span class='title'>` to the value returned from getTodoText
> Note that if we left off the `()` we'd actully be assiging innerText to the 'function' instead of the function return
4. Insert our new todo into the todo's parent (the `ul`), before our reference todo. [insertBefore](https://developer.mozilla.org/en-US/docs/Web/API/Node/insertBefore)
- **filter()** - This function takes in a `filterName` string, and a `button` which is a reference to the clicked button.
1. Remove any `selected` class names
2. Add `selected` to the clicked button
3. Get all of the todos with [querySelectAll](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll), and then loop through them.
4. Set the `hidden` property of each todo based on the filter/state combination
### Triggering functions from click events
Now that we have a working `addTodo` function, we need a way to trigger it when the user is ready. This can be done in two ways.
1. We can find the element with querySelector, then set its `onclick` to our function
```js
document.querySelector('.addTodo .submit').onclick = addTodo;
```
2. We can add the function directly to our button in our HTML
```html
<button onclick="addTodo()" class="submit">Add</button>
```
Today we'll use #2, as this is the way it will work in React as well.
## Exercise
### Write updateRemaining function
1. Get a reference to the span with the `remaining` class, and store it in a variable
2. Use [querySelectAll](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll) to get all of the todos.
3. Set the `innerText` of the remaining span to the length of those todos.
4. Add updateRemaining() to addTodo
### Write a clearCompleted function
1. Get a reference to all of the todos with [querySelectAll](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll)
2. Use a `for (let todo of todos)` loop to iterate over each todo
3. Inside the for loop write an `if` statement to test if the `input` inside of the todo has a checked value of true
> Hint: you can use querySelector on any HTML node to find child elements within
4. Call `todo.remove()` for any todo whos input check is true
5. After the loop is done, run `updateRemaining()`
6. Attach this function to the footer button
7. Test it out!

View File

@@ -0,0 +1,74 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<header>
<h1>todos</h1>
<div class="addTodo">
<input class="textfield" placeholder="add todo" />
<button class="submit">Add</button>
</div>
<nav class="filter">
<button class="selected">all</button>
<button>active</button>
<button>completed</button>
</nav>
</header>
<ul class="todos">
<li class="todo">
<label><input type="checkbox" /> <span class="title"> Todo 1 </span></label>
</li>
<li class="todo">
<label><input type="checkbox" /> <span class="title"> Todo 2 </span></label>
</li>
<li class="todo">
<label><input type="checkbox" /> <span class="title"> Todo 3 </span></label>
</li>
<li class="todo">
<label><input type="checkbox" /> <span class="title"> Todo 4 </span></label>
</li>
</ul>
<footer>
<span><span class="remaining">4</span> items left</span>
<button class="submit">Clear Completed</button>
</footer>
</body>
<script type="text/javascript">
function clearInput(selector) {
document.querySelector(selector).value = '';
}
function getTodoText() {
return document.querySelector('.textfield').value;
}
function addTodo() {
const todo = document.querySelector('.todo');
const newTodo = todo.cloneNode(true);
newTodo.querySelector('.title').innerText = getTodoText();
todo.parentElement.insertBefore(newTodo, todo);
clearInput('.textfield');
// updateRemaining();
}
function filter(filterName, button) {
document.querySelector('.selected').classList.remove('selected');
button.classList.add('selected');
for (let todo of document.querySelectorAll('.todo')) {
const checked = todo.querySelector('input').checked == true;
if (filterName == 'all') {
todo.hidden = false;
} else if (filterName == 'active') {
todo.hidden = checked;
} else if (filterName == 'completed') {
todo.hidden = !checked;
}
}
}
</script>
</html>

View File

@@ -3,19 +3,21 @@ body {
width: 400px;
margin: 20px auto;
}
h1 {
text-align: center;
}
.addTodo {
display: flex;
}
.textfield {
width: 80%;
flex-grow: 1;
margin-right: 10px;
}
.add {
margin-left: 5%;
}
.button {
.submit {
border: none;
padding: 5px 10px;
}
@@ -28,6 +30,7 @@ h1 {
background: transparent;
border: none;
}
.filter .selected {
border-bottom: 2px solid blue;
}
@@ -44,7 +47,3 @@ footer {
footer span {
flex-grow: 1;
}
.hidden {
display: none;
}

View File

@@ -0,0 +1,82 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<header>
<h1>todos</h1>
<div class="addTodo">
<input class="textfield" placeholder="add todo" />
<button onclick="addTodo()" class="submit">Add</button>
</div>
<nav class="filter">
<button class="selected">all</button>
<button>active</button>
<button>completed</button>
</nav>
</header>
<ul class="todos">
<li class="todo">
<label><input type="checkbox" /> <span class="title"> Todo 1 </span></label>
</li>
<li class="todo">
<label><input type="checkbox" /> <span class="title"> Todo 2 </span></label>
</li>
<li class="todo">
<label><input type="checkbox" /> <span class="title"> Todo 3 </span></label>
</li>
<li class="todo">
<label><input type="checkbox" /> <span class="title"> Todo 4 </span></label>
</li>
</ul>
<footer>
<span><span class="remaining">4</span> items left</span>
<button class="submit">Clear Completed</button>
</footer>
</body>
<script type="text/javascript">
function clearInput(selector) {
document.querySelector(selector).value = '';
}
function getTodoText() {
return document.querySelector('.textfield').value;
}
function updateRemaining() {
const remaining = document.querySelector('.remaining');
const todos = document.querySelectorAll('.todo').length;
remaining.innerText = todos;
}
function addTodo() {
const todo = document.querySelector('.todo');
const newTodo = todo.cloneNode(true);
newTodo.querySelector('.title').innerText = getTodoText();
todo.parentElement.insertBefore(newTodo, todo);
clearInput('.textfield');
updateRemaining();
}
// clearCompleted
function filter(filterName, button) {
document.querySelector('.selected').classList.remove('selected');
button.classList.add('selected');
for (let todo of document.querySelectorAll('.todo')) {
const checked = todo.querySelector('input').checked == true;
if (filterName == 'all') {
todo.hidden = false;
} else if (filterName == 'active') {
todo.hidden = checked;
} else if (filterName == 'completed') {
todo.hidden = !checked;
}
}
}
</script>
</html>

View File

@@ -3,19 +3,21 @@ body {
width: 400px;
margin: 20px auto;
}
h1 {
text-align: center;
}
.addTodo {
display: flex;
}
.textfield {
width: 80%;
flex-grow: 1;
margin-right: 10px;
}
.add {
margin-left: 5%;
}
.button {
.submit {
border: none;
padding: 5px 10px;
}
@@ -28,6 +30,7 @@ h1 {
background: transparent;
border: none;
}
.filter .selected {
border-bottom: 2px solid blue;
}
@@ -44,7 +47,3 @@ footer {
footer span {
flex-grow: 1;
}
.hidden {
display: none;
}

View File

@@ -0,0 +1,90 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<header>
<h1>todos</h1>
<div class="addTodo">
<input class="textfield" placeholder="add todo" />
<button onclick="addTodo()" class="submit">Add</button>
</div>
<nav class="filter">
<button onclick="filter('all', this)" class="selected">all</button>
<button onclick="filter('active', this)">active</button>
<button onclick="filter('completed', this)">completed</button>
</nav>
</header>
<ul class="todos">
<li class="todo">
<label><input type="checkbox" /> <span class="title"> Todo 1 </span></label>
</li>
<li class="todo">
<label><input type="checkbox" /> <span class="title"> Todo 2 </span></label>
</li>
<li class="todo">
<label><input type="checkbox" /> <span class="title"> Todo 3 </span></label>
</li>
<li class="todo">
<label><input type="checkbox" /> <span class="title"> Todo 4 </span></label>
</li>
</ul>
<footer>
<span><span class="remaining">4</span> items left</span>
<button onclick="clearCompleted()" class="submit">Clear Completed</button>
</footer>
</body>
<script type="text/javascript">
function clearInput(selector) {
document.querySelector(selector).value = '';
}
function getTodoText() {
return document.querySelector('.textfield').value;
}
function updateRemaining() {
const remaining = document.querySelector('.remaining');
const todos = document.querySelectorAll('.todo');
remaining.innerText = todos;
}
function addTodo() {
const todo = document.querySelector('.todo');
const newTodo = todo.cloneNode(true);
newTodo.querySelector('.title').innerText = getTodoText();
todo.parentElement.insertBefore(newTodo, todo);
clearInput('.textfield');
updateRemaining();
}
function clearCompleted() {
const todos = document.querySelectorAll('.todo');
for (let todo of todos) {
if (todo.querySelector('input').checked == true) {
todo.remove();
}
}
updateRemaining();
}
function filter(filterName, button) {
document.querySelector('.selected').classList.remove('selected');
button.classList.add('selected');
for (let todo of document.querySelectorAll('.todo')) {
const checked = todo.querySelector('input').checked == true;
if (filterName == 'all') {
todo.hidden = false;
} else if (filterName == 'active') {
todo.hidden = checked;
} else if (filterName == 'completed') {
todo.hidden = !checked;
}
}
}
</script>
</html>

View File

@@ -3,19 +3,21 @@ body {
width: 400px;
margin: 20px auto;
}
h1 {
text-align: center;
}
.addTodo {
display: flex;
}
.textfield {
width: 80%;
flex-grow: 1;
margin-right: 10px;
}
.add {
margin-left: 5%;
}
.button {
.submit {
border: none;
padding: 5px 10px;
}
@@ -28,6 +30,7 @@ h1 {
background: transparent;
border: none;
}
.filter .selected {
border-bottom: 2px solid blue;
}
@@ -44,7 +47,3 @@ footer {
footer span {
flex-grow: 1;
}
.hidden {
display: none;
}

View File

@@ -1,86 +1,16 @@
<!DOCTYPE html>
<html>
<link rel="stylesheet" href="./style.css" />
<body>
<h1>todos</h1>
<input class="textfield" placeholder="add todo" />
<button onclick="addTodo()" class="button add">
Add
</button>
<div class="filter">
<button onclick="filter('all', this)" class="selected">all</button>
<button onclick="filter('active', this)">active</button>
<button onclick="filter('completed', this)">completed</button>
<head>
<link rel="stylesheet" href="../assets/shared.css" />
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/9.6.1/css/fabric.min.css" />
</head>
<body class="ms-Fabric">
<div class="Container">
<ul class="Tiles">
<li class="Tile"><a href="./demo/index.html" class="Tile-link">Demo Start</a></li>
<li class="Tile"><a href="./exercise/index.html" class="Tile-link">Exercise Start</a></li>
<li class="Tile"><a href="./final/index.html" class="Tile-link">Final</a></li>
</ul>
</div>
<ul class="todos">
<li class="todo">
<label><input type="checkbox" /> Todo 1</label>
</li>
<li class="todo">
<label><input type="checkbox" /> Todo 2</label>
</li>
<li class="todo">
<label><input type="checkbox" /> Todo 3</label>
</li>
<li class="todo">
<label><input type="checkbox" /> Todo 4</label>
</li>
</ul>
<footer>
<span><span class="remaining">4</span> items left</span>
<button onclick="clearCompleted()" class="button">Clear Completed</button>
</footer>
</body>
<script type="text/javascript">
function getValue(selector) {
const inputValue = document.querySelector(selector).value;
return inputValue;
}
function clearInput(selector) {
document.querySelector(selector).value = '';
}
function updateRemaining() {
const remaining = document.querySelector('.remaining');
const todos = document.querySelectorAll('.todo').length;
remaining.innerText = todos;
}
function addTodo() {
const todo = document.querySelector('.todo');
const newTodo = todo.cloneNode();
newTodo.innerHTML = `<label><input type="checkbox" /> ${getValue('.textfield')}</label>`;
todo.parentElement.insertBefore(newTodo, todo);
clearInput('.textfield');
updateRemaining();
}
function clearCompleted() {
const todos = document.querySelectorAll('.todo');
for (let todo of todos) {
if (todo.querySelector('input').checked == true) {
todo.remove();
}
}
updateRemaining();
}
function filter(scope, button) {
document.querySelector('.active').classList.remove('active');
button.classList.add('active');
for (let todo of document.querySelectorAll('.todo')) {
const checked = todo.querySelector('input').checked == true;
if (scope == 'all') {
todo.hidden = false;
} else if (scope == 'active') {
todo.hidden = checked;
} else if (scope == 'completed') {
todo.hidden = !checked;
}
}
}
</script>
</html>

View File

@@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<div id="app"></div>
<script src="../../step1-04/final/step1-04/final.js"></script></body>
</html>

View File

@@ -6,7 +6,8 @@ export class App extends React.Component {
return (
<div>
<h2>My App</h2>
<Counter start={2} />
<Counter text="Chickens" />
<Counter text="Ducks" />
</div>
);
}

View File

@@ -1,4 +1,5 @@
.Button {
display: block;
background: #0078d4;
color: white;
padding: 5px 10px;

View File

@@ -0,0 +1,25 @@
import React from 'react';
import { Button } from './Button';
export class Counter extends React.Component<any, any> {
constructor(props) {
super(props);
this.state = {
counter: 0
};
}
render() {
const { counter } = this.state;
const { text } = this.props;
return (
<div>
{text}: {counter}
<Button onClick={this._onButtonCLick}>Click</Button>
</div>
);
}
_onButtonCLick = () => {
this.setState({ counter: this.state.counter + 1 });
};
}

View File

@@ -0,0 +1,4 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { App } from './App';
ReactDOM.render(<App />, document.getElementById('app'));

View File

@@ -81,19 +81,19 @@
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./step1-04/src/index.tsx");
/******/ return __webpack_require__(__webpack_require__.s = "./step1-04/final/src/index.tsx");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./node_modules/css-loader/dist/cjs.js!./step1-04/src/components/Button.css":
/*!**********************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./step1-04/src/components/Button.css ***!
\**********************************************************************************/
/***/ "./node_modules/css-loader/dist/cjs.js!./step1-04/final/src/components/Button.css":
/*!****************************************************************************************!*\
!*** ./node_modules/css-loader/dist/cjs.js!./step1-04/final/src/components/Button.css ***!
\****************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\")(false);\n// Module\nexports.push([module.i, \".Button {\\n background: #0078d4;\\n color: white;\\n padding: 5px 10px;\\n outline: none;\\n border: none;\\n}\\n.Button:hover {\\n background: #005a9e;\\n}\\n\\n.Button:active {\\n background: #004578;\\n}\\n\", \"\"]);\n\n\n\n//# sourceURL=webpack:///./step1-04/src/components/Button.css?./node_modules/css-loader/dist/cjs.js");
eval("exports = module.exports = __webpack_require__(/*! ../../../../node_modules/css-loader/dist/runtime/api.js */ \"./node_modules/css-loader/dist/runtime/api.js\")(false);\n// Module\nexports.push([module.i, \".Button {\\n display: block;\\n background: #0078d4;\\n color: white;\\n padding: 5px 10px;\\n outline: none;\\n border: none;\\n}\\n.Button:hover {\\n background: #005a9e;\\n}\\n\\n.Button:active {\\n background: #004578;\\n}\\n\", \"\"]);\n\n\n\n//# sourceURL=webpack:///./step1-04/final/src/components/Button.css?./node_modules/css-loader/dist/cjs.js");
/***/ }),
@@ -274,62 +274,62 @@ eval("var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn th
/***/ }),
/***/ "./step1-04/src/App.tsx":
/*!******************************!*\
!*** ./step1-04/src/App.tsx ***!
\******************************/
/***/ "./step1-04/final/src/App.tsx":
/*!************************************!*\
!*** ./step1-04/final/src/App.tsx ***!
\************************************/
/*! exports provided: App */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"App\", function() { return App; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _components_Counter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/Counter */ \"./step1-04/src/components/Counter.tsx\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\nvar App = /** @class */ (function (_super) {\n __extends(App, _super);\n function App() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n App.prototype.render = function () {\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", null,\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"h2\", null, \"My App\"),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_Counter__WEBPACK_IMPORTED_MODULE_1__[\"Counter\"], { start: 2 })));\n };\n return App;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component));\n\n\n\n//# sourceURL=webpack:///./step1-04/src/App.tsx?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"App\", function() { return App; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _components_Counter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/Counter */ \"./step1-04/final/src/components/Counter.tsx\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\nvar App = /** @class */ (function (_super) {\n __extends(App, _super);\n function App() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n App.prototype.render = function () {\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", null,\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"h2\", null, \"My App\"),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_Counter__WEBPACK_IMPORTED_MODULE_1__[\"Counter\"], { text: \"Chickens\" }),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_Counter__WEBPACK_IMPORTED_MODULE_1__[\"Counter\"], { text: \"Ducks\" })));\n };\n return App;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component));\n\n\n\n//# sourceURL=webpack:///./step1-04/final/src/App.tsx?");
/***/ }),
/***/ "./step1-04/src/components/Button.css":
/*!********************************************!*\
!*** ./step1-04/src/components/Button.css ***!
\********************************************/
/***/ "./step1-04/final/src/components/Button.css":
/*!**************************************************!*\
!*** ./step1-04/final/src/components/Button.css ***!
\**************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
eval("\nvar content = __webpack_require__(/*! !../../../node_modules/css-loader/dist/cjs.js!./Button.css */ \"./node_modules/css-loader/dist/cjs.js!./step1-04/src/components/Button.css\");\n\nif(typeof content === 'string') content = [[module.i, content, '']];\n\nvar transform;\nvar insertInto;\n\n\n\nvar options = {\"hmr\":true}\n\noptions.transform = transform\noptions.insertInto = undefined;\n\nvar update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ \"./node_modules/style-loader/lib/addStyles.js\")(content, options);\n\nif(content.locals) module.exports = content.locals;\n\nif(false) {}\n\n//# sourceURL=webpack:///./step1-04/src/components/Button.css?");
eval("\nvar content = __webpack_require__(/*! !../../../../node_modules/css-loader/dist/cjs.js!./Button.css */ \"./node_modules/css-loader/dist/cjs.js!./step1-04/final/src/components/Button.css\");\n\nif(typeof content === 'string') content = [[module.i, content, '']];\n\nvar transform;\nvar insertInto;\n\n\n\nvar options = {\"hmr\":true}\n\noptions.transform = transform\noptions.insertInto = undefined;\n\nvar update = __webpack_require__(/*! ../../../../node_modules/style-loader/lib/addStyles.js */ \"./node_modules/style-loader/lib/addStyles.js\")(content, options);\n\nif(content.locals) module.exports = content.locals;\n\nif(false) {}\n\n//# sourceURL=webpack:///./step1-04/final/src/components/Button.css?");
/***/ }),
/***/ "./step1-04/src/components/Button.tsx":
/*!********************************************!*\
!*** ./step1-04/src/components/Button.tsx ***!
\********************************************/
/***/ "./step1-04/final/src/components/Button.tsx":
/*!**************************************************!*\
!*** ./step1-04/final/src/components/Button.tsx ***!
\**************************************************/
/*! exports provided: Button */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Button\", function() { return Button; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Button_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Button.css */ \"./step1-04/src/components/Button.css\");\n/* harmony import */ var _Button_css__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_Button_css__WEBPACK_IMPORTED_MODULE_1__);\n\n\nvar Button = function (props) {\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", { className: \"Button\", onClick: props.onClick }, props.children));\n};\n\n\n//# sourceURL=webpack:///./step1-04/src/components/Button.tsx?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Button\", function() { return Button; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Button_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Button.css */ \"./step1-04/final/src/components/Button.css\");\n/* harmony import */ var _Button_css__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_Button_css__WEBPACK_IMPORTED_MODULE_1__);\n\n\nvar Button = function (props) {\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", { className: \"Button\", onClick: props.onClick }, props.children));\n};\n\n\n//# sourceURL=webpack:///./step1-04/final/src/components/Button.tsx?");
/***/ }),
/***/ "./step1-04/src/components/Counter.tsx":
/*!*********************************************!*\
!*** ./step1-04/src/components/Counter.tsx ***!
\*********************************************/
/***/ "./step1-04/final/src/components/Counter.tsx":
/*!***************************************************!*\
!*** ./step1-04/final/src/components/Counter.tsx ***!
\***************************************************/
/*! exports provided: Counter */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Counter\", function() { return Counter; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Button__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Button */ \"./step1-04/src/components/Button.tsx\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\nvar Counter = /** @class */ (function (_super) {\n __extends(Counter, _super);\n function Counter(props) {\n var _this = _super.call(this, props) || this;\n _this.state = {\n counter: props.start\n };\n return _this;\n }\n Counter.prototype.render = function () {\n var _this = this;\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", null,\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"span\", null,\n \" \",\n this.state.counter,\n \" \"),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_Button__WEBPACK_IMPORTED_MODULE_1__[\"Button\"], { onClick: function () {\n _this.setState({ counter: _this.state.counter + 1 });\n } }, \"Click Me\")));\n };\n return Counter;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component));\n\n\n\n//# sourceURL=webpack:///./step1-04/src/components/Counter.tsx?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Counter\", function() { return Counter; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Button__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Button */ \"./step1-04/final/src/components/Button.tsx\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\nvar Counter = /** @class */ (function (_super) {\n __extends(Counter, _super);\n function Counter(props) {\n var _this = _super.call(this, props) || this;\n _this._onButtonCLick = function () {\n _this.setState({ counter: _this.state.counter + 1 });\n };\n _this.state = {\n counter: 0\n };\n return _this;\n }\n Counter.prototype.render = function () {\n var counter = this.state.counter;\n var text = this.props.text;\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", null,\n text,\n \": \",\n counter,\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_Button__WEBPACK_IMPORTED_MODULE_1__[\"Button\"], { onClick: this._onButtonCLick }, \"Click\")));\n };\n return Counter;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component));\n\n\n\n//# sourceURL=webpack:///./step1-04/final/src/components/Counter.tsx?");
/***/ }),
/***/ "./step1-04/src/index.tsx":
/*!********************************!*\
!*** ./step1-04/src/index.tsx ***!
\********************************/
/***/ "./step1-04/final/src/index.tsx":
/*!**************************************!*\
!*** ./step1-04/final/src/index.tsx ***!
\**************************************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _App__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./App */ \"./step1-04/src/App.tsx\");\n\n\n\nreact_dom__WEBPACK_IMPORTED_MODULE_1___default.a.render(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_App__WEBPACK_IMPORTED_MODULE_2__[\"App\"], null), document.getElementById(\"app\"));\n\n\n//# sourceURL=webpack:///./step1-04/src/index.tsx?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _App__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./App */ \"./step1-04/final/src/App.tsx\");\n\n\n\nreact_dom__WEBPACK_IMPORTED_MODULE_1___default.a.render(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_App__WEBPACK_IMPORTED_MODULE_2__[\"App\"], null), document.getElementById('app'));\n\n\n//# sourceURL=webpack:///./step1-04/final/src/index.tsx?");
/***/ })

View File

@@ -1,8 +0,0 @@
<!DOCTYPE html>
<html>
<body>
<div id="app"></div>
<script type="text/javascript" src="../step1-04/step1-04.js"></script></body>
</html>

View File

@@ -1,25 +0,0 @@
import React from 'react';
import { Button } from './Button';
export class Counter extends React.Component<any, any> {
constructor(props) {
super(props);
this.state = {
counter: props.start
};
}
render() {
return (
<div>
<span> {this.state.counter} </span>
<Button
onClick={() => {
this.setState({ counter: this.state.counter + 1 });
}}
>
Click Me
</Button>
</div>
);
}
}

View File

@@ -1,4 +0,0 @@
import React from "react";
import ReactDOM from "react-dom";
import { App } from "./App";
ReactDOM.render(<App />, document.getElementById("app"));

View File

@@ -3,7 +3,7 @@
<link rel="stylesheet" href="./src/style.css" />
<body>
<div id="app"></div>
<script type="text/javascript" src="../step1-06/step1-06.js"></script></body>
<script src="../../step1-05/demo/step1-05/demo.js"></script></body>
</html>

View File

@@ -3,16 +3,14 @@ import { TodoFooter } from './components/TodoFooter';
import { TodoHeader } from './components/TodoHeader';
import { TodoList } from './components/TodoList';
export class TodoApp extends React.Component {
render() {
return (
<div>
<TodoHeader />
<TodoList />
<TodoFooter />
</div>
<div>
<TodoHeader />
<TodoList />
<TodoFooter />
</div>
);
}
}

View File

@@ -0,0 +1,9 @@
import React from 'react';
export const TodoFooter = (props: any) => {
return (
<footer>
<p>footer</p>
</footer>
);
};

View File

@@ -0,0 +1,7 @@
import React from 'react';
export class TodoHeader extends React.Component {
render() {
return <div />;
}
}

View File

@@ -0,0 +1,7 @@
import React from 'react';
export class TodoList extends React.Component<any, any> {
render() {
return <div />;
}
}

View File

@@ -0,0 +1,7 @@
import React from 'react';
export class TodoListItem extends React.Component {
render() {
return <div />;
}
}

View File

@@ -0,0 +1,49 @@
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
width: 400px;
margin: 20px auto;
}
h1 {
text-align: center;
}
.addTodo {
display: flex;
}
.textfield {
flex-grow: 1;
margin-right: 10px;
}
.submit {
border: none;
padding: 5px 10px;
}
.filter {
margin: 10px 0 0;
}
.filter button {
background: transparent;
border: none;
}
.filter .selected {
border-bottom: 2px solid blue;
}
.todos {
list-style: none;
padding: 0;
}
footer {
display: flex;
}
footer span {
flex-grow: 1;
}

File diff suppressed because one or more lines are too long

View File

@@ -3,7 +3,7 @@
<link rel="stylesheet" href="./src/style.css" />
<body>
<div id="app"></div>
<script type="text/javascript" src="../step1-05/step1-05.js"></script></body>
<script src="../../step1-05/exercise/step1-05/exercise.js"></script></body>
</html>

View File

@@ -0,0 +1,16 @@
import React from 'react';
import { TodoFooter } from './components/TodoFooter';
import { TodoHeader } from './components/TodoHeader';
import { TodoList } from './components/TodoList';
export class TodoApp extends React.Component {
render() {
return (
<div>
<TodoHeader />
<TodoList />
<TodoFooter />
</div>
);
}
}

View File

@@ -0,0 +1,9 @@
import React from 'react';
export const TodoFooter = (props: any) => {
return (
<footer>
<p>footer</p>
</footer>
);
};

View File

@@ -3,16 +3,18 @@ import React from 'react';
export class TodoHeader extends React.Component {
render() {
return (
<div>
<header>
<h1>todos</h1>
<input className="textfield" placeholder="add todo" />
<button className="button add">Add</button>
<div className="filter">
<div className="addTodo">
<input className="textfield" placeholder="add todo" />
<button className="submit">Add</button>
</div>
<nav className="filter">
<button className="completed">all</button>
<button>active</button>
<button>completed</button>
</div>
</div>
</nav>
</header>
);
}
}

View File

@@ -0,0 +1,7 @@
import React from 'react';
export class TodoList extends React.Component<any, any> {
render() {
return <div />;
}
}

View File

@@ -0,0 +1,4 @@
import React from "react";
import ReactDOM from "react-dom";
import { TodoApp } from "./App";
ReactDOM.render(<TodoApp />, document.getElementById("app"));

View File

@@ -0,0 +1,49 @@
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
width: 400px;
margin: 20px auto;
}
h1 {
text-align: center;
}
.addTodo {
display: flex;
}
.textfield {
flex-grow: 1;
margin-right: 10px;
}
.submit {
border: none;
padding: 5px 10px;
}
.filter {
margin: 10px 0 0;
}
.filter button {
background: transparent;
border: none;
}
.filter .selected {
border-bottom: 2px solid blue;
}
.todos {
list-style: none;
padding: 0;
}
footer {
display: flex;
}
footer span {
flex-grow: 1;
}

File diff suppressed because one or more lines are too long

View File

@@ -3,7 +3,7 @@
<link rel="stylesheet" href="./src/style.css" />
<body>
<div id="app"></div>
<script type="text/javascript" src="../step1-07/step1-07.js"></script></body>
<script src="../../step1-05/final/step1-05/final.js"></script></body>
</html>

View File

@@ -0,0 +1,16 @@
import React from 'react';
import { TodoFooter } from './components/TodoFooter';
import { TodoHeader } from './components/TodoHeader';
import { TodoList } from './components/TodoList';
export class TodoApp extends React.Component {
render() {
return (
<div>
<TodoHeader />
<TodoList />
<TodoFooter />
</div>
);
}
}

View File

@@ -1,13 +1,12 @@
import React from "react";
import React from 'react';
export const TodoFooter = (props: any) => {
return (
<footer>
<span>
<span className="remaining">4</span> items left
</span>
<button className="button">Clear Completed</button>
<button className="submit">Clear Completed</button>
</footer>
);
};

View File

@@ -0,0 +1,20 @@
import React from 'react';
export class TodoHeader extends React.Component {
render() {
return (
<header>
<h1>todos</h1>
<div className="addTodo">
<input className="textfield" placeholder="add todo" />
<button className="submit">Add</button>
</div>
<nav className="filter">
<button className="completed">all</button>
<button>active</button>
<button>completed</button>
</nav>
</header>
);
}
}

View File

@@ -3,14 +3,12 @@ import { TodoListItem } from './TodoListItem';
export class TodoList extends React.Component<any, any> {
render() {
const { filter, todos } = this.props;
return (
<ul className="todos">
<TodoListItem/>
<TodoListItem/>
<TodoListItem/>
<TodoListItem/>
<TodoListItem />
<TodoListItem />
<TodoListItem />
<TodoListItem />
</ul>
);
}

View File

@@ -0,0 +1,13 @@
import React from "react";
export class TodoListItem extends React.Component {
render() {
return (
<li className="todo">
<label>
<input type="checkbox" /> Todo 1
</label>
</li>
);
}
}

View File

@@ -0,0 +1,49 @@
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
width: 400px;
margin: 20px auto;
}
h1 {
text-align: center;
}
.addTodo {
display: flex;
}
.textfield {
flex-grow: 1;
margin-right: 10px;
}
.submit {
border: none;
padding: 5px 10px;
}
.filter {
margin: 10px 0 0;
}
.filter button {
background: transparent;
border: none;
}
.filter .selected {
border-bottom: 2px solid blue;
}
.todos {
list-style: none;
padding: 0;
}
footer {
display: flex;
}
footer span {
flex-grow: 1;
}

View File

@@ -81,7 +81,7 @@
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./step1-05/src/index.tsx");
/******/ return __webpack_require__(__webpack_require__.s = "./step1-05/final/src/index.tsx");
/******/ })
/************************************************************************/
/******/ ({
@@ -229,75 +229,75 @@ eval("var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn th
/***/ }),
/***/ "./step1-05/src/App.tsx":
/*!******************************!*\
!*** ./step1-05/src/App.tsx ***!
\******************************/
/***/ "./step1-05/final/src/TodoApp.tsx":
/*!****************************************!*\
!*** ./step1-05/final/src/TodoApp.tsx ***!
\****************************************/
/*! exports provided: TodoApp */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TodoApp\", function() { return TodoApp; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _components_TodoFooter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/TodoFooter */ \"./step1-05/src/components/TodoFooter.tsx\");\n/* harmony import */ var _components_TodoHeader__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/TodoHeader */ \"./step1-05/src/components/TodoHeader.tsx\");\n/* harmony import */ var _components_TodoList__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/TodoList */ \"./step1-05/src/components/TodoList.tsx\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\n\n\nvar TodoApp = /** @class */ (function (_super) {\n __extends(TodoApp, _super);\n function TodoApp() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n TodoApp.prototype.render = function () {\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", null,\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_TodoHeader__WEBPACK_IMPORTED_MODULE_2__[\"TodoHeader\"], null),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_TodoList__WEBPACK_IMPORTED_MODULE_3__[\"TodoList\"], null),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_TodoFooter__WEBPACK_IMPORTED_MODULE_1__[\"TodoFooter\"], null)));\n };\n return TodoApp;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component));\n\n\n\n//# sourceURL=webpack:///./step1-05/src/App.tsx?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TodoApp\", function() { return TodoApp; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _components_TodoFooter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/TodoFooter */ \"./step1-05/final/src/components/TodoFooter.tsx\");\n/* harmony import */ var _components_TodoHeader__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/TodoHeader */ \"./step1-05/final/src/components/TodoHeader.tsx\");\n/* harmony import */ var _components_TodoList__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/TodoList */ \"./step1-05/final/src/components/TodoList.tsx\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\n\n\nvar TodoApp = /** @class */ (function (_super) {\n __extends(TodoApp, _super);\n function TodoApp() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n TodoApp.prototype.render = function () {\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", null,\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_TodoHeader__WEBPACK_IMPORTED_MODULE_2__[\"TodoHeader\"], null),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_TodoList__WEBPACK_IMPORTED_MODULE_3__[\"TodoList\"], null),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_TodoFooter__WEBPACK_IMPORTED_MODULE_1__[\"TodoFooter\"], null)));\n };\n return TodoApp;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component));\n\n\n\n//# sourceURL=webpack:///./step1-05/final/src/TodoApp.tsx?");
/***/ }),
/***/ "./step1-05/src/components/TodoFooter.tsx":
/*!************************************************!*\
!*** ./step1-05/src/components/TodoFooter.tsx ***!
\************************************************/
/***/ "./step1-05/final/src/components/TodoFooter.tsx":
/*!******************************************************!*\
!*** ./step1-05/final/src/components/TodoFooter.tsx ***!
\******************************************************/
/*! exports provided: TodoFooter */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TodoFooter\", function() { return TodoFooter; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n\nvar TodoFooter = function (props) {\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"footer\", null,\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"span\", null,\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"span\", { className: \"remaining\" }, \"4\"),\n \" items left\"),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", { className: \"button\" }, \"Clear Completed\")));\n};\n\n\n//# sourceURL=webpack:///./step1-05/src/components/TodoFooter.tsx?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TodoFooter\", function() { return TodoFooter; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n\nvar TodoFooter = function (props) {\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"footer\", null,\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"span\", null,\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"span\", { className: \"remaining\" }, \"4\"),\n \" items left\"),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", { className: \"submit\" }, \"Clear Completed\")));\n};\n\n\n//# sourceURL=webpack:///./step1-05/final/src/components/TodoFooter.tsx?");
/***/ }),
/***/ "./step1-05/src/components/TodoHeader.tsx":
/*!************************************************!*\
!*** ./step1-05/src/components/TodoHeader.tsx ***!
\************************************************/
/***/ "./step1-05/final/src/components/TodoHeader.tsx":
/*!******************************************************!*\
!*** ./step1-05/final/src/components/TodoHeader.tsx ***!
\******************************************************/
/*! exports provided: TodoHeader */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TodoHeader\", function() { return TodoHeader; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\nvar TodoHeader = /** @class */ (function (_super) {\n __extends(TodoHeader, _super);\n function TodoHeader() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n TodoHeader.prototype.render = function () {\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", null,\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"h1\", null, \"todos\"),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"input\", { className: \"textfield\", placeholder: \"add todo\" }),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", { className: \"button add\" }, \"Add\"),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", { className: \"filter\" },\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", { className: \"active\" }, \"all\"),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", null, \"active\"),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", null, \"completed\"))));\n };\n return TodoHeader;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component));\n\n\n\n//# sourceURL=webpack:///./step1-05/src/components/TodoHeader.tsx?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TodoHeader\", function() { return TodoHeader; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\nvar TodoHeader = /** @class */ (function (_super) {\n __extends(TodoHeader, _super);\n function TodoHeader() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n TodoHeader.prototype.render = function () {\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"header\", null,\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"h1\", null, \"todos\"),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", { className: \"addTodo\" },\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"input\", { className: \"textfield\", placeholder: \"add todo\" }),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", { className: \"submit\" }, \"Add\")),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"nav\", { className: \"filter\" },\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", { className: \"completed\" }, \"all\"),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", null, \"active\"),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", null, \"completed\"))));\n };\n return TodoHeader;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component));\n\n\n\n//# sourceURL=webpack:///./step1-05/final/src/components/TodoHeader.tsx?");
/***/ }),
/***/ "./step1-05/src/components/TodoList.tsx":
/*!**********************************************!*\
!*** ./step1-05/src/components/TodoList.tsx ***!
\**********************************************/
/***/ "./step1-05/final/src/components/TodoList.tsx":
/*!****************************************************!*\
!*** ./step1-05/final/src/components/TodoList.tsx ***!
\****************************************************/
/*! exports provided: TodoList */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TodoList\", function() { return TodoList; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _TodoListItem__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TodoListItem */ \"./step1-05/src/components/TodoListItem.tsx\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\nvar TodoList = /** @class */ (function (_super) {\n __extends(TodoList, _super);\n function TodoList() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n TodoList.prototype.render = function () {\n var _a = this.props, filter = _a.filter, todos = _a.todos;\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"ul\", { className: \"todos\" },\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_TodoListItem__WEBPACK_IMPORTED_MODULE_1__[\"TodoListItem\"], null),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_TodoListItem__WEBPACK_IMPORTED_MODULE_1__[\"TodoListItem\"], null),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_TodoListItem__WEBPACK_IMPORTED_MODULE_1__[\"TodoListItem\"], null),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_TodoListItem__WEBPACK_IMPORTED_MODULE_1__[\"TodoListItem\"], null)));\n };\n return TodoList;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component));\n\n\n\n//# sourceURL=webpack:///./step1-05/src/components/TodoList.tsx?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TodoList\", function() { return TodoList; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _TodoListItem__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TodoListItem */ \"./step1-05/final/src/components/TodoListItem.tsx\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\nvar TodoList = /** @class */ (function (_super) {\n __extends(TodoList, _super);\n function TodoList() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n TodoList.prototype.render = function () {\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"ul\", { className: \"todos\" },\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_TodoListItem__WEBPACK_IMPORTED_MODULE_1__[\"TodoListItem\"], null),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_TodoListItem__WEBPACK_IMPORTED_MODULE_1__[\"TodoListItem\"], null),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_TodoListItem__WEBPACK_IMPORTED_MODULE_1__[\"TodoListItem\"], null),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_TodoListItem__WEBPACK_IMPORTED_MODULE_1__[\"TodoListItem\"], null)));\n };\n return TodoList;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component));\n\n\n\n//# sourceURL=webpack:///./step1-05/final/src/components/TodoList.tsx?");
/***/ }),
/***/ "./step1-05/src/components/TodoListItem.tsx":
/*!**************************************************!*\
!*** ./step1-05/src/components/TodoListItem.tsx ***!
\**************************************************/
/***/ "./step1-05/final/src/components/TodoListItem.tsx":
/*!********************************************************!*\
!*** ./step1-05/final/src/components/TodoListItem.tsx ***!
\********************************************************/
/*! exports provided: TodoListItem */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TodoListItem\", function() { return TodoListItem; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\nvar TodoListItem = /** @class */ (function (_super) {\n __extends(TodoListItem, _super);\n function TodoListItem() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n TodoListItem.prototype.render = function () {\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"li\", { className: \"todo\" },\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"label\", null,\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"input\", { type: \"checkbox\" }),\n \" Todo 1\")));\n };\n return TodoListItem;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component));\n\n\n\n//# sourceURL=webpack:///./step1-05/src/components/TodoListItem.tsx?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TodoListItem\", function() { return TodoListItem; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\nvar TodoListItem = /** @class */ (function (_super) {\n __extends(TodoListItem, _super);\n function TodoListItem() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n TodoListItem.prototype.render = function () {\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"li\", { className: \"todo\" },\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"label\", null,\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"input\", { type: \"checkbox\" }),\n \" Todo 1\")));\n };\n return TodoListItem;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component));\n\n\n\n//# sourceURL=webpack:///./step1-05/final/src/components/TodoListItem.tsx?");
/***/ }),
/***/ "./step1-05/src/index.tsx":
/*!********************************!*\
!*** ./step1-05/src/index.tsx ***!
\********************************/
/***/ "./step1-05/final/src/index.tsx":
/*!**************************************!*\
!*** ./step1-05/final/src/index.tsx ***!
\**************************************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _App__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./App */ \"./step1-05/src/App.tsx\");\n\n\n\nreact_dom__WEBPACK_IMPORTED_MODULE_1___default.a.render(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_App__WEBPACK_IMPORTED_MODULE_2__[\"TodoApp\"], null), document.getElementById(\"app\"));\n\n\n//# sourceURL=webpack:///./step1-05/src/index.tsx?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _TodoApp__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TodoApp */ \"./step1-05/final/src/TodoApp.tsx\");\n\n\n\nreact_dom__WEBPACK_IMPORTED_MODULE_1___default.a.render(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_TodoApp__WEBPACK_IMPORTED_MODULE_2__[\"TodoApp\"], null), document.getElementById('app'));\n\n\n//# sourceURL=webpack:///./step1-05/final/src/index.tsx?");
/***/ })

View File

@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<link rel="stylesheet" href="./src/style.css" />
<body>
<div id="app"></div>
<script src="../../step1-06/demo/step1-06/demo.js"></script></body>
</html>

View File

@@ -0,0 +1,16 @@
import React from 'react';
import { TodoFooter } from './components/TodoFooter';
import { TodoHeader } from './components/TodoHeader';
import { TodoList } from './components/TodoList';
export class TodoApp extends React.Component {
render() {
return (
<div>
<TodoHeader />
<TodoList />
<TodoFooter />
</div>
);
}
}

View File

@@ -0,0 +1,11 @@
import React from 'react';
export const TodoFooter = (props: any) => {
const itemCount = Object.keys(props.todos).filter(id => !props.todos[id].completed).length;
return (
<footer>
<span>4 items left</span>
<button className="submit">Clear Completed</button>
</footer>
);
};

View File

@@ -0,0 +1,29 @@
import React from 'react';
export class TodoHeader extends React.Component<any, any> {
constructor(props) {
super(props);
this.state = { labelInput: '' };
}
render() {
return (
<header>
<h1>todos</h1>
<div className="addTodo">
<input className="textfield" placeholder="add todo" />
<button className="submit">Add</button>
</div>
<nav className="filter">
<button className="completed">all</button>
<button>active</button>
<button>completed</button>
</nav>
</header>
);
}
_onChange = evt => {
this.setState({ labelInput: evt.target.value });
};
}

View File

@@ -0,0 +1,20 @@
import React from 'react';
import { TodoListItem } from './TodoListItem';
export class TodoList extends React.Component<any, any> {
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);
});
return (
<ul className="todos">
<TodoListItem />
<TodoListItem />
<TodoListItem />
<TodoListItem />
</ul>
);
}
}

View File

@@ -0,0 +1,13 @@
import React from "react";
export class TodoListItem extends React.Component {
render() {
return (
<li className="todo">
<label>
<input type="checkbox" /> Todo 1
</label>
</li>
);
}
}

View File

@@ -0,0 +1,49 @@
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
width: 400px;
margin: 20px auto;
}
h1 {
text-align: center;
}
.addTodo {
display: flex;
}
.textfield {
flex-grow: 1;
margin-right: 10px;
}
.submit {
border: none;
padding: 5px 10px;
}
.filter {
margin: 10px 0 0;
}
.filter button {
background: transparent;
border: none;
}
.filter .selected {
border-bottom: 2px solid blue;
}
.todos {
list-style: none;
padding: 0;
}
footer {
display: flex;
}
footer span {
flex-grow: 1;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<link rel="stylesheet" href="./src/style.css" />
<body>
<div id="app"></div>
<script src="../../step1-06/exercise/step1-06/exercise.js"></script></body>
</html>

View File

@@ -0,0 +1,11 @@
import React from 'react';
export const TodoFooter = (props: any) => {
const itemCount = Object.keys(props.todos).filter(id => !props.todos[id].completed).length;
return (
<footer>
<span>4 items left</span>
<button className="submit">Clear Completed</button>
</footer>
);
};

View File

@@ -1,19 +1,30 @@
import React from 'react';
export class TodoHeader extends React.Component<any, any> {
constructor(props) {
super(props);
this.state = { labelInput: '' };
}
render() {
const { filter } = this.props;
return (
<div>
<header>
<h1>todos</h1>
<input className="textfield" placeholder="add todo" />
<button className="button add">Add</button>
<div className="filter">
<div className="addTodo">
<input value={this.state.labelInput} onChange={this._onChange} className="textfield" placeholder="add todo" />
<button className="submit">Add</button>
</div>
<nav className="filter">
<button className={filter == 'all' ? 'completed' : ''}>all</button>
<button className={filter == 'active' ? 'completed' : ''}>active</button>
<button className={filter == 'completed' ? 'completed' : ''}>completed</button>
</div>
</div>
</nav>
</header>
);
}
_onChange = evt => {
this.setState({ labelInput: evt.target.value });
};
}

View File

@@ -0,0 +1,13 @@
import React from 'react';
export class TodoListItem extends React.Component<any, any> {
render() {
return (
<li className="todo">
<label>
<input type="checkbox" /> Todo 1
</label>
</li>
);
}
}

View File

@@ -0,0 +1,4 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { TodoApp } from './TodoApp';
ReactDOM.render(<TodoApp />, document.getElementById('app'));

View File

@@ -0,0 +1,49 @@
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
width: 400px;
margin: 20px auto;
}
h1 {
text-align: center;
}
.addTodo {
display: flex;
}
.textfield {
flex-grow: 1;
margin-right: 10px;
}
.submit {
border: none;
padding: 5px 10px;
}
.filter {
margin: 10px 0 0;
}
.filter button {
background: transparent;
border: none;
}
.filter .selected {
border-bottom: 2px solid blue;
}
.todos {
list-style: none;
padding: 0;
}
footer {
display: flex;
}
footer span {
flex-grow: 1;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<link rel="stylesheet" href="./src/style.css" />
<body>
<div id="app"></div>
<script src="../../step1-06/final/step1-06/final.js"></script></body>
</html>

View File

@@ -0,0 +1,41 @@
import React from 'react';
import { TodoFooter } from './components/TodoFooter';
import { TodoHeader } from './components/TodoHeader';
import { TodoList } from './components/TodoList';
export class TodoApp extends React.Component<any, any> {
constructor(props) {
super(props);
this.state = {
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'
};
}
render() {
const { filter, todos } = this.state;
return (
<div>
<TodoHeader filter={filter} />
<TodoList todos={todos} filter={filter} />
<TodoFooter todos={todos} />
</div>
);
}
}

View File

@@ -7,7 +7,7 @@ export const TodoFooter = (props: any) => {
<span>
{itemCount} item{itemCount > 1 ? 's' : ''} left
</span>
<button className="button">Clear Completed</button>
<button className="submit">Clear Completed</button>
</footer>
);
};

View File

@@ -0,0 +1,30 @@
import React from 'react';
export class TodoHeader extends React.Component<any, any> {
render() {
const { filter } = this.props;
return (
<header>
<h1>todos</h1>
<div className="addTodo">
<input value={this.state.labelInput} onChange={this._onChange} className="textfield" placeholder="add todo" />
<button className="submit">Add</button>
</div>
<nav className="filter">
<button className={filter == 'all' ? 'completed' : ''}>all</button>
<button className={filter == 'active' ? 'completed' : ''}>active</button>
<button className={filter == 'completed' ? 'completed' : ''}>completed</button>
</nav>
</header>
);
}
_onChange = evt => {
this.setState({ labelInput: evt.target.value });
};
_onAdd = () => {
console.log(this.state.labelInput);
this.setState({ labelInput: '' });
};
}

View File

@@ -0,0 +1,19 @@
import React from 'react';
import { TodoListItem } from './TodoListItem';
export class TodoList extends React.Component<any, any> {
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);
});
return (
<ul className="todos">
{filteredTodos.map(id => (
<TodoListItem key={id} {...todos[id]} />
))}
</ul>
);
}
}

View File

@@ -0,0 +1,4 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { TodoApp } from './TodoApp';
ReactDOM.render(<TodoApp />, document.getElementById('app'));

View File

@@ -0,0 +1,49 @@
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
width: 400px;
margin: 20px auto;
}
h1 {
text-align: center;
}
.addTodo {
display: flex;
}
.textfield {
flex-grow: 1;
margin-right: 10px;
}
.submit {
border: none;
padding: 5px 10px;
}
.filter {
margin: 10px 0 0;
}
.filter button {
background: transparent;
border: none;
}
.filter .selected {
border-bottom: 2px solid blue;
}
.todos {
list-style: none;
padding: 0;
}
footer {
display: flex;
}
footer span {
flex-grow: 1;
}

View File

@@ -81,7 +81,7 @@
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./step1-06/src/index.tsx");
/******/ return __webpack_require__(__webpack_require__.s = "./step1-06/final/src/index.tsx");
/******/ })
/************************************************************************/
/******/ ({
@@ -229,75 +229,75 @@ eval("var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn th
/***/ }),
/***/ "./step1-06/src/TodoApp.tsx":
/*!**********************************!*\
!*** ./step1-06/src/TodoApp.tsx ***!
\**********************************/
/***/ "./step1-06/final/src/TodoApp.tsx":
/*!****************************************!*\
!*** ./step1-06/final/src/TodoApp.tsx ***!
\****************************************/
/*! exports provided: TodoApp */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TodoApp\", function() { return TodoApp; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _components_TodoFooter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/TodoFooter */ \"./step1-06/src/components/TodoFooter.tsx\");\n/* harmony import */ var _components_TodoHeader__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/TodoHeader */ \"./step1-06/src/components/TodoHeader.tsx\");\n/* harmony import */ var _components_TodoList__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/TodoList */ \"./step1-06/src/components/TodoList.tsx\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\n\n\nvar TodoApp = /** @class */ (function (_super) {\n __extends(TodoApp, _super);\n function TodoApp(props) {\n var _this = _super.call(this, props) || this;\n _this.state = {\n todos: {\n '04': {\n label: 'Todo 4',\n completed: true\n },\n '03': {\n label: 'Todo 3',\n completed: false\n },\n '02': {\n label: 'Todo 2',\n completed: false\n },\n '01': {\n label: 'Todo 1',\n completed: false\n }\n },\n filter: 'all'\n };\n return _this;\n }\n TodoApp.prototype.render = function () {\n var _a = this.state, filter = _a.filter, todos = _a.todos;\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", null,\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_TodoHeader__WEBPACK_IMPORTED_MODULE_2__[\"TodoHeader\"], { filter: filter }),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_TodoList__WEBPACK_IMPORTED_MODULE_3__[\"TodoList\"], { todos: todos, filter: filter }),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_TodoFooter__WEBPACK_IMPORTED_MODULE_1__[\"TodoFooter\"], { todos: todos })));\n };\n return TodoApp;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component));\n\n\n\n//# sourceURL=webpack:///./step1-06/src/TodoApp.tsx?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TodoApp\", function() { return TodoApp; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _components_TodoFooter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/TodoFooter */ \"./step1-06/final/src/components/TodoFooter.tsx\");\n/* harmony import */ var _components_TodoHeader__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/TodoHeader */ \"./step1-06/final/src/components/TodoHeader.tsx\");\n/* harmony import */ var _components_TodoList__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/TodoList */ \"./step1-06/final/src/components/TodoList.tsx\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\n\n\n\nvar TodoApp = /** @class */ (function (_super) {\n __extends(TodoApp, _super);\n function TodoApp(props) {\n var _this = _super.call(this, props) || this;\n _this.state = {\n todos: {\n '04': {\n label: 'Todo 4',\n completed: true\n },\n '03': {\n label: 'Todo 3',\n completed: false\n },\n '02': {\n label: 'Todo 2',\n completed: false\n },\n '01': {\n label: 'Todo 1',\n completed: false\n }\n },\n filter: 'all'\n };\n return _this;\n }\n TodoApp.prototype.render = function () {\n var _a = this.state, filter = _a.filter, todos = _a.todos;\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", null,\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_TodoHeader__WEBPACK_IMPORTED_MODULE_2__[\"TodoHeader\"], { filter: filter }),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_TodoList__WEBPACK_IMPORTED_MODULE_3__[\"TodoList\"], { todos: todos, filter: filter }),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_TodoFooter__WEBPACK_IMPORTED_MODULE_1__[\"TodoFooter\"], { todos: todos })));\n };\n return TodoApp;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component));\n\n\n\n//# sourceURL=webpack:///./step1-06/final/src/TodoApp.tsx?");
/***/ }),
/***/ "./step1-06/src/components/TodoFooter.tsx":
/*!************************************************!*\
!*** ./step1-06/src/components/TodoFooter.tsx ***!
\************************************************/
/***/ "./step1-06/final/src/components/TodoFooter.tsx":
/*!******************************************************!*\
!*** ./step1-06/final/src/components/TodoFooter.tsx ***!
\******************************************************/
/*! exports provided: TodoFooter */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TodoFooter\", function() { return TodoFooter; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n\nvar TodoFooter = function (props) {\n var itemCount = Object.keys(props.todos).filter(function (id) { return !props.todos[id].completed; }).length;\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"footer\", null,\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"span\", null,\n itemCount,\n \" item\",\n itemCount > 1 ? 's' : '',\n \" left\"),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", { className: \"button\" }, \"Clear Completed\")));\n};\n\n\n//# sourceURL=webpack:///./step1-06/src/components/TodoFooter.tsx?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TodoFooter\", function() { return TodoFooter; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n\nvar TodoFooter = function (props) {\n var itemCount = Object.keys(props.todos).filter(function (id) { return !props.todos[id].completed; }).length;\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"footer\", null,\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"span\", null,\n itemCount,\n \" item\",\n itemCount > 1 ? 's' : '',\n \" left\"),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", { className: \"submit\" }, \"Clear Completed\")));\n};\n\n\n//# sourceURL=webpack:///./step1-06/final/src/components/TodoFooter.tsx?");
/***/ }),
/***/ "./step1-06/src/components/TodoHeader.tsx":
/*!************************************************!*\
!*** ./step1-06/src/components/TodoHeader.tsx ***!
\************************************************/
/***/ "./step1-06/final/src/components/TodoHeader.tsx":
/*!******************************************************!*\
!*** ./step1-06/final/src/components/TodoHeader.tsx ***!
\******************************************************/
/*! exports provided: TodoHeader */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TodoHeader\", function() { return TodoHeader; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\nvar TodoHeader = /** @class */ (function (_super) {\n __extends(TodoHeader, _super);\n function TodoHeader() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n TodoHeader.prototype.render = function () {\n var filter = this.props.filter;\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", null,\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"h1\", null, \"todos\"),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"input\", { className: \"textfield\", placeholder: \"add todo\" }),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", { className: \"button add\" }, \"Add\"),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", { className: \"filter\" },\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", { className: filter == 'all' ? 'active' : '' }, \"all\"),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", { className: filter == 'active' ? 'active' : '' }, \"active\"),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", { className: filter == 'completed' ? 'active' : '' }, \"completed\"))));\n };\n return TodoHeader;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component));\n\n\n\n//# sourceURL=webpack:///./step1-06/src/components/TodoHeader.tsx?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TodoHeader\", function() { return TodoHeader; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\nvar TodoHeader = /** @class */ (function (_super) {\n __extends(TodoHeader, _super);\n function TodoHeader() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this._onChange = function (evt) {\n _this.setState({ labelInput: evt.target.value });\n };\n _this._onAdd = function () {\n console.log(_this.state.labelInput);\n _this.setState({ labelInput: '' });\n };\n return _this;\n }\n TodoHeader.prototype.render = function () {\n var filter = this.props.filter;\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"header\", null,\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"h1\", null, \"todos\"),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"div\", { className: \"addTodo\" },\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"input\", { value: this.state.labelInput, onChange: this._onChange, className: \"textfield\", placeholder: \"add todo\" }),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", { className: \"submit\" }, \"Add\")),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"nav\", { className: \"filter\" },\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", { className: filter == 'all' ? 'completed' : '' }, \"all\"),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", { className: filter == 'active' ? 'completed' : '' }, \"active\"),\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"button\", { className: filter == 'completed' ? 'completed' : '' }, \"completed\"))));\n };\n return TodoHeader;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component));\n\n\n\n//# sourceURL=webpack:///./step1-06/final/src/components/TodoHeader.tsx?");
/***/ }),
/***/ "./step1-06/src/components/TodoList.tsx":
/*!**********************************************!*\
!*** ./step1-06/src/components/TodoList.tsx ***!
\**********************************************/
/***/ "./step1-06/final/src/components/TodoList.tsx":
/*!****************************************************!*\
!*** ./step1-06/final/src/components/TodoList.tsx ***!
\****************************************************/
/*! exports provided: TodoList */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TodoList\", function() { return TodoList; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _TodoListItem__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TodoListItem */ \"./step1-06/src/components/TodoListItem.tsx\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __assign = (undefined && undefined.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\n\n\nvar TodoList = /** @class */ (function (_super) {\n __extends(TodoList, _super);\n function TodoList() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n TodoList.prototype.render = function () {\n var _a = this.props, filter = _a.filter, todos = _a.todos;\n var filteredTodos = Object.keys(todos).filter(function (id) {\n return filter === 'all' || (filter === 'completed' && todos[id].completed) || (filter === 'active' && !todos[id].completed);\n });\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"ul\", { className: \"todos\" }, filteredTodos.map(function (id) { return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_TodoListItem__WEBPACK_IMPORTED_MODULE_1__[\"TodoListItem\"], __assign({ key: id }, todos[id]))); })));\n };\n return TodoList;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component));\n\n\n\n//# sourceURL=webpack:///./step1-06/src/components/TodoList.tsx?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TodoList\", function() { return TodoList; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _TodoListItem__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TodoListItem */ \"./step1-06/final/src/components/TodoListItem.tsx\");\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __assign = (undefined && undefined.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\n\n\nvar TodoList = /** @class */ (function (_super) {\n __extends(TodoList, _super);\n function TodoList() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n TodoList.prototype.render = function () {\n var _a = this.props, filter = _a.filter, todos = _a.todos;\n var filteredTodos = Object.keys(todos).filter(function (id) {\n return filter === 'all' || (filter === 'completed' && todos[id].completed) || (filter === 'active' && !todos[id].completed);\n });\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"ul\", { className: \"todos\" }, filteredTodos.map(function (id) { return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_TodoListItem__WEBPACK_IMPORTED_MODULE_1__[\"TodoListItem\"], __assign({ key: id }, todos[id]))); })));\n };\n return TodoList;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component));\n\n\n\n//# sourceURL=webpack:///./step1-06/final/src/components/TodoList.tsx?");
/***/ }),
/***/ "./step1-06/src/components/TodoListItem.tsx":
/*!**************************************************!*\
!*** ./step1-06/src/components/TodoListItem.tsx ***!
\**************************************************/
/***/ "./step1-06/final/src/components/TodoListItem.tsx":
/*!********************************************************!*\
!*** ./step1-06/final/src/components/TodoListItem.tsx ***!
\********************************************************/
/*! exports provided: TodoListItem */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TodoListItem\", function() { return TodoListItem; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\nvar TodoListItem = /** @class */ (function (_super) {\n __extends(TodoListItem, _super);\n function TodoListItem() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n TodoListItem.prototype.render = function () {\n var _a = this.props, label = _a.label, completed = _a.completed;\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"li\", { className: \"todo\" },\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"label\", null,\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"input\", { type: \"checkbox\", checked: completed }),\n \" \",\n label)));\n };\n return TodoListItem;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component));\n\n\n\n//# sourceURL=webpack:///./step1-06/src/components/TodoListItem.tsx?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TodoListItem\", function() { return TodoListItem; });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\nvar __extends = (undefined && undefined.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\n\nvar TodoListItem = /** @class */ (function (_super) {\n __extends(TodoListItem, _super);\n function TodoListItem() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n TodoListItem.prototype.render = function () {\n var _a = this.props, label = _a.label, completed = _a.completed;\n return (react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"li\", { className: \"todo\" },\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"label\", null,\n react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(\"input\", { type: \"checkbox\", checked: completed }),\n \" \",\n label)));\n };\n return TodoListItem;\n}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component));\n\n\n\n//# sourceURL=webpack:///./step1-06/final/src/components/TodoListItem.tsx?");
/***/ }),
/***/ "./step1-06/src/index.tsx":
/*!********************************!*\
!*** ./step1-06/src/index.tsx ***!
\********************************/
/***/ "./step1-06/final/src/index.tsx":
/*!**************************************!*\
!*** ./step1-06/final/src/index.tsx ***!
\**************************************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _TodoApp__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TodoApp */ \"./step1-06/src/TodoApp.tsx\");\n\n\n\nreact_dom__WEBPACK_IMPORTED_MODULE_1___default.a.render(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_TodoApp__WEBPACK_IMPORTED_MODULE_2__[\"TodoApp\"], null), document.getElementById('app'));\n\n\n//# sourceURL=webpack:///./step1-06/src/index.tsx?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"./node_modules/react-dom/index.js\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _TodoApp__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TodoApp */ \"./step1-06/final/src/TodoApp.tsx\");\n\n\n\nreact_dom__WEBPACK_IMPORTED_MODULE_1___default.a.render(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_TodoApp__WEBPACK_IMPORTED_MODULE_2__[\"TodoApp\"], null), document.getElementById('app'));\n\n\n//# sourceURL=webpack:///./step1-06/final/src/index.tsx?");
/***/ })

View File

@@ -0,0 +1,7 @@
<!DOCTYPE html>
<html>
<link rel="stylesheet" href="./src/style.css" />
<body>
<div id="app"></div>
<script src="../../step1-07/demo/step1-07/demo.js"></script></body>
</html>

Some files were not shown because too many files have changed in this diff Show More