mirror of
https://github.com/microsoft/frontend-bootcamp.git
synced 2026-01-26 14:56:42 +08:00
Merge branch 'master' of github.com:kenotron/bootcamp
This commit is contained in:
@@ -55,6 +55,7 @@ body {
|
||||
flex-direction: column;
|
||||
height: 148px;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
text-decoration: none;
|
||||
width: 148px;
|
||||
|
||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
@@ -1,5 +1,9 @@
|
||||
/* https://developer.mozilla.org/en-US/docs/Learn/CSS/Introduction_to_CSS/Combinators_and_multiple_selectors */
|
||||
|
||||
body {
|
||||
font: 1.2em sans-serif;
|
||||
}
|
||||
|
||||
/* Targeting an HTML tag */
|
||||
h1 {
|
||||
/* Color name */
|
||||
29
step1-00/css-demo/css-demo-finished.html
Normal file
29
step1-00/css-demo/css-demo-finished.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="./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="./fabric.jpg" width="100" alt="fabric logo" />
|
||||
</div>
|
||||
<div>
|
||||
<h2>Contact Us</h2>
|
||||
<div id="contact-form">
|
||||
<label>Email</label><input type="email" />
|
||||
<input value="Submit" type="submit" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
0
step1-00/css-demo/css-demo.css
Normal file
0
step1-00/css-demo/css-demo.css
Normal file
@@ -84,7 +84,7 @@
|
||||
|
||||
<h3>Figure</h3>
|
||||
<figure>
|
||||
<img src="./fabric.jpg" alt="Fabric Logo" />
|
||||
<img src="../assets/fabric.jpg" alt="Fabric Logo" />
|
||||
<figcaption>The Fabric Logo</figcaption>
|
||||
</figure>
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
<body class="ms-Fabric">
|
||||
<div class="Container">
|
||||
<ul class="Tiles">
|
||||
<li class="Tile"><a href="./html-demo.html" class="Tile-link">HTML Demo</a></li>
|
||||
<li class="Tile"><a href="./css-demo.html" class="Tile-link">CSS Demo</a></li>
|
||||
<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>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -2,22 +2,26 @@
|
||||
<html>
|
||||
<body>
|
||||
<h1>todos</h1>
|
||||
<div>
|
||||
<input/><button>Add</button>
|
||||
</div>
|
||||
<div><input placeholder="add todo" /><button>Add</button></div>
|
||||
<div>
|
||||
<button>all</button>
|
||||
<button>active</button>
|
||||
<button>completed</button>
|
||||
</div>
|
||||
<ul>
|
||||
<li><input type="checkbox" /> Todo 1</li>
|
||||
<li><input type="checkbox" /> Todo 2</li>
|
||||
<li><input type="checkbox" /> Todo 3</li>
|
||||
<li><input type="checkbox" /> Todo 4</li>
|
||||
<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>
|
||||
<div><span>4 items left</span> <button>Clear Completed</button></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<link rel="stylesheet" href="./style.css" />
|
||||
<body>
|
||||
<h1>todos</h1>
|
||||
<input class="textfield" /><button class="button add">Add</button>
|
||||
<input class="textfield" placeholder="add todo" /><button class="button add">Add</button>
|
||||
<div class="filter">
|
||||
<button class="active">all</button>
|
||||
<button>active</button>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<link rel="stylesheet" href="./style.css" />
|
||||
<body>
|
||||
<h1>todos</h1>
|
||||
<input class="textfield" />
|
||||
<input class="textfield" placeholder="add todo" />
|
||||
<button onclick="addTodo()" class="button add">
|
||||
Add
|
||||
</button>
|
||||
@@ -33,38 +33,35 @@
|
||||
</body>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function getValue(selector) {
|
||||
const inputValue = document.querySelector(selector).value;
|
||||
return inputValue;
|
||||
}
|
||||
|
||||
function clearInput(selector) {
|
||||
document.querySelector(selector).value = "";
|
||||
document.querySelector(selector).value = '';
|
||||
}
|
||||
|
||||
function updateRemaining() {
|
||||
const remaining = document.querySelector(".remaining");
|
||||
const todos = document.querySelectorAll(".todo").length;
|
||||
const remaining = document.querySelector('.remaining');
|
||||
const todos = document.querySelectorAll('.todo').length;
|
||||
remaining.innerText = todos;
|
||||
}
|
||||
|
||||
function addTodo() {
|
||||
const todo = document.querySelector(".todo");
|
||||
const todo = document.querySelector('.todo');
|
||||
const newTodo = todo.cloneNode();
|
||||
newTodo.innerHTML = `<label><input type="checkbox" /> ${getValue(
|
||||
".textfield"
|
||||
)}</label>`;
|
||||
newTodo.innerHTML = `<label><input type="checkbox" /> ${getValue('.textfield')}</label>`;
|
||||
todo.parentElement.insertBefore(newTodo, todo);
|
||||
|
||||
clearInput(".textfield");
|
||||
clearInput('.textfield');
|
||||
updateRemaining();
|
||||
}
|
||||
|
||||
function clearCompleted() {
|
||||
const todos = document.querySelectorAll(".todo");
|
||||
const todos = document.querySelectorAll('.todo');
|
||||
for (let todo of todos) {
|
||||
if (todo.querySelector("input").checked == true) {
|
||||
if (todo.querySelector('input').checked == true) {
|
||||
todo.remove();
|
||||
}
|
||||
}
|
||||
@@ -74,15 +71,13 @@
|
||||
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;
|
||||
for (let todo of document.querySelectorAll('.todo')) {
|
||||
const checked = todo.querySelector('input').checked == true;
|
||||
if (scope == 'all') {
|
||||
todo.hidden = false;
|
||||
}
|
||||
else if ( scope == 'active' ){
|
||||
} else if (scope == 'active') {
|
||||
todo.hidden = checked;
|
||||
}
|
||||
else if ( scope == 'completed' ){
|
||||
} else if (scope == 'completed') {
|
||||
todo.hidden = !checked;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,14 @@
|
||||
import React from 'react';
|
||||
|
||||
export class TodoHeader extends React.Component {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<h1>todos</h1>
|
||||
<input className="textfield" />
|
||||
<button className="button add">
|
||||
Add
|
||||
</button>
|
||||
<input className="textfield" placeholder="add todo" />
|
||||
<button className="button add">Add</button>
|
||||
<div className="filter">
|
||||
<button className="active">
|
||||
all
|
||||
</button>
|
||||
<button className="active">all</button>
|
||||
<button>active</button>
|
||||
<button>completed</button>
|
||||
</div>
|
||||
|
||||
@@ -6,7 +6,7 @@ export class TodoHeader extends React.Component<any, any> {
|
||||
return (
|
||||
<div>
|
||||
<h1>todos</h1>
|
||||
<input className="textfield" />
|
||||
<input className="textfield" placeholder="add todo" />
|
||||
<button className="button add">Add</button>
|
||||
<div className="filter">
|
||||
<button className={filter == 'all' ? 'active' : ''}>all</button>
|
||||
|
||||
@@ -18,7 +18,7 @@ export class TodoHeader extends React.Component<TodoHeaderProps, any> {
|
||||
return (
|
||||
<div>
|
||||
<h1>todos</h1>
|
||||
<input value={this.state.labelInput} onChange={this._onChange} className="textfield" />
|
||||
<input value={this.state.labelInput} onChange={this._onChange} className="textfield" placeholder="add todo" />
|
||||
<button onClick={this._onAdd} className="button add">
|
||||
Add
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user