Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="wrapper"></div>
              
            
!

CSS

              
                html { font-size: 62.5%; }
html,body,#wrapper {height: 100%;}
/* body */

body
{
    font-size: 1.4rem; 
    line-height: normal;
    letter-spacing: normal;
    background-color: #f9f9f9;
    background-image: url(https://www.pakutaso.com/shared/img/thumb/Photoelly037_TP_V.jpg);
    background-position: center center;
    -webkit-background-size: cover;
         -o-background-size: cover;
            background-size: cover;
}

.wrapper
{
	margin: 0px auto;
	width: 100%;
	position: relative;
	display: flex;
}
.contents {
	width: 80%;
	max-width: 600px;
	margin: 0 auto;
	margin-top: 10vh;
	max-height: 80vh;
	background-color: #fff;
	-webkit-border-radius: 20px;
	        border-radius: 20px;
	-webkit-box-shadow: 0px 1px 10px #777;
	        box-shadow: 0px 1px 10px #777;
	
}
.contents h1 {
	text-align: center;
	border-bottom: 1px solid #ddd;
	padding: 15px 0;
	font-size: 1.6rem;
	/*height: 40px;*/
}
.main {
	padding: 10px 20px;
	overflow: hidden;
	width: 100%;
}
.add {
	width: 100%;
	padding: 10px;
	height: 40px;
	font-size: 14px;
  border-bottom: 1px solid #ddd;
	-webkit-transition: 0.3s;
	   -moz-transition: 0.3s;
	    -ms-transition: 0.3s;
	     -o-transition: 0.3s;
	        transition: 0.3s;
}
.add:focus {
	outline: none;
  border-bottom-color: #bbb;
  letter-spacing: 1px;
}
.lists {
	margin-top: 10px;
	overflow: auto;

	width: 575px;
	height: calc(80vh - 164px );
}
.lists li {
	width: 560px;
	/*border-top: 1px solid #ccc;*/
	display: flex;
	padding: 6px 10px;
	align-items:center;
	
}

.lists li * {
	font-size: 1.6rem;
	color: #555;
}
.lists li label {
	cursor: pointer;
	
}
.lists li label input {
	display: none;
}
.lists li label span {
	font-size: 2rem;
	display: inline-block;
	-webkit-transition: all 0.2s;
	   -moz-transition: all 0.2s;
	    -ms-transition: all 0.2s;
	     -o-transition: all 0.2s;
	        transition: all 0.2s;
  color: #999;
}
.lists li label span:hover {
	-webkit-transform: scale(1.08);
	   -moz-transform: scale(1.08);
	    -ms-transform: scale(1.08);
	     -o-transform: scale(1.08);
	        transform: scale(1.08);
}
.lists li label input:checked ~ span {
	color: #3498db;
}
.lists li input[type=text] {
	flex-grow: 1;
	margin: 0 10px;
	padding: 5px 8px;
	
}
.lists li input[type=text]:focus {
	-webkit-box-shadow: 0 0 3px #ccc;
	        box-shadow: 0 0 3px #ccc;
	
	outline: none;
}
.lists li .delete {
	cursor: pointer;
	opacity: 0;
}
.lists li:hover .delete {
	opacity: 1;
}
.filters {
	width: 100%;
	border-top: 1px solid #ddd;
	padding: 10px 10px 10px 0;
	text-align: right;
}
.filters select {
	border: none;
	background-color: #fff;
	font-size: 1.4rem;
}
.filters select:focus {
	outline: none;
}

@media screen and (max-width: 768px) {
	.contents {
		margin-top: 5vh;
		max-height: 90vh;
		width: 90%;
	}
	.main {
		padding: 15px;
	}
	.lists {
		height: calc(90vh - 170px );
	}
}

@font-face {
  font-family: 'icomoon';
  src:  url('https://cdn.linearicons.com/free/1.0.0/Linearicons-Free.eot');
  src:  url('https://cdn.linearicons.com/free/1.0.0/Linearicons-Free.eot?#iefix') format('embedded-opentype'),
    url('https://cdn.linearicons.com/free/1.0.0/Linearicons-Free.ttf') format('truetype'),
    url('https://cdn.linearicons.com/free/1.0.0/Linearicons-Free.woff') format('woff'),
    url('https://cdn.linearicons.com/free/1.0.0/Linearicons-Free.svg#Linearicons-Free') format('svg');
  font-weight: normal;
  font-style: normal;
}

[class^="icon-"], [class*=" icon-"] {
  /* use !important to prevent issues with browser extensions that change fonts */
  font-family: 'icomoon' !important;
  speak: none;
  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  text-transform: none;
  line-height: 1;

  /* Better Font Rendering =========== */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


.icon-checkmark-circle:before {
  content: "\e87f";
}

.icon-pencil:before {
  content: "\e802";
}
.icon-trash:before {
  content: "\e811";
}

              
            
!

JS

              
                var todoListLS = [];
//ローカルストレージ関係
var todoStorage = {
  get: function (todos) {
    todoListLS = JSON.parse(localStorage.getItem('simpleTodo') || '[]');
    return todoListLS;
  },
  save: function (todos) {
    todoListLS = todos;
    localStorage.setItem('simpleTodo', JSON.stringify(todoListLS));
  }
}

class TodoAdd extends React.Component {
	constructor(props){
		super(props);
    this.state = {
      newTodo: ""
    };
	}
	handleChange(event){
			this.setState({newTodo: event.target.value});
	}
	handleNewTodoKeyDown(event){
		if (event.keyCode !== 13) {
			return;
		}
		var val = this.state.newTodo;
		this.props.onTodoSubmit({title: val,check:false})
		if (val) {
				this.setState({newTodo: ''});
		}
	}
	render() {
    return (
			<input type="text" placeholder="タスクを記入" className="add" onKeyDown={this.handleNewTodoKeyDown.bind(this)} onChange={this.handleChange.bind(this)} value={this.state.newTodo} />
		)
  }
}


class TodoItem extends React.Component {
	handleDelete(){
    this.props.onTodoDelete(this.props.todo.id);
  }
	handleEdit(event){
		var title = event.target.value;
    this.props.onTodoEdit(this.props.todo.id,title);
  }
	toggleCheck(event) {
		var checked = event.target.checked;
		this.props.onTodoCheck(this.props.todo.id,checked);
	}
  render() {
    return(
			<li>
        <label><input type="checkbox" name="check" checked={this.props.todo.check} onChange={this.toggleCheck.bind(this)} /><span className="icon-checkmark-circle"></span></label>
        <input type="text" name="task" value={this.props.todo.title} onChange={this.handleEdit.bind(this)} />
        <span className="delete icon-trash" onClick={this.handleDelete.bind(this)}></span>
      </li>
		);
  }
}
					
class Todo extends React.Component {
	constructor(props){
		super(props);
    this.state = {
      todos: todoStorage.get(),
			sortfilter: "all"
    };
	}
	handleTodoAdd(todo) {
    todo.id = new Date();
    const newTodo = this.state.todos.concat(todo);
    this.setState({todos: newTodo});
  }
	handleTodoEdit(id,title) {
		const newTodo = this.state.todos.map((todo) => {
				if(todo.id == id){
					todo.title = title;
				}
		return todo;
		})
		this.setState({todos: newTodo});
  }
	handleTodoDelete(id) {
		const newTodo = this.state.todos.filter((todo) => {
        return todo.id !== id;
    })
    this.setState({todos: newTodo});
	}
	handleTodoCheck(id,check) {
		const newTodo = this.state.todos.map((todo) => {
				if(todo.id == id){
					todo.check = check;
				}
        return todo;
    })
		this.setState({todos: newTodo});
	}
	handleTodoSort(event) {
		this.setState({sortfilter: event.target.value});
	}
	componentWillUpdate(nextProps,nextState){
		todoStorage.save(nextState.todos);
	}
	
  render() {
		const filterTodos = this.state.todos.filter((todo) => {
			var filterTask = this.state.sortfilter;
      if(filterTask == "all"){
        return todo;
      }else if(filterTask == "complete"){
        return todo.check;
      }else if(filterTask == "incomplete"){
        return !todo.check;
      }
		})
		const todoItems = filterTodos.map((todo) => {
      return (
        <TodoItem 
					key={todo.id}
					todo={todo} 
					onTodoEdit={this.handleTodoEdit.bind(this)} 
					onTodoDelete={this.handleTodoDelete.bind(this)}
					onTodoCheck={this.handleTodoCheck.bind(this)}
				/>
      )
    })
    return(
			<div className="contents">
				<h1>Todo</h1>
				<div className="main todoList">
					<TodoAdd onTodoSubmit={this.handleTodoAdd.bind(this)} />
					<ul className="lists">
					{todoItems}
					</ul>
					<div className="filters">
						<select name="todoChange" onChange={this.handleTodoSort.bind(this)}
								>
          		<option value="all">All Tasks</option>
            	<option value="incomplete">Incompelete Tasks</option>
            	<option value="complete">Complete Tasks</option>
          	</select>
					</div>
				</div>
				
			</div>
		);
  }
}
ReactDOM.render(
  <Todo />,
  document.getElementsByClassName('wrapper')[0]
);
              
            
!
999px

Console