diff --git a/app.js b/app.js
index ab737a60027..86b11f72e40 100644
--- a/app.js
+++ b/app.js
@@ -18,6 +18,7 @@ var completedTasksHolder=document.getElementById("completed-tasks");//completed-
var createNewTaskElement=function(taskString){
var listItem=document.createElement("li");
+ listItem.classList.add("list-item")
//input (checkbox)
var checkBox=document.createElement("input");//checkbx
@@ -25,26 +26,46 @@ var createNewTaskElement=function(taskString){
var label=document.createElement("label");//label
//input (text)
var editInput=document.createElement("input");//text
- //button.edit
+ //list-item__element_button_edit
var editButton=document.createElement("button");//edit button
-
- //button.delete
+ //list-item__element_button_delete
var deleteButton=document.createElement("button");//delete button
var deleteButtonImg=document.createElement("img");//delete button image
+
label.innerText=taskString;
- label.className='task';
+ label.classList.add("list-item__element");
+ label.classList.add("list-item__element_label");
+ label.classList.add("list-item__element_task");
+
+ // label.className="list-item__element_task";
//Each elements, needs appending
checkBox.type="checkbox";
+ checkBox.classList.add("list-item__element");
+ checkBox.classList.add("list-item__element_input");
+ checkBox.classList.add("list-item__element_checkbox");
+
editInput.type="text";
- editInput.className="task";
+ editInput.classList.add("list-item__element");
+ editInput.classList.add("list-item__element_input");
+ editInput.classList.add("list-item__element_text-input");
+ editInput.classList.add("list-item__element_task");
+ // editInput.className="list-item__element_task";
editButton.innerText="Edit"; //innerText encodes special characters, HTML does not.
- editButton.className="edit";
-
- deleteButton.className="delete";
- deleteButtonImg.src='./remove.svg';
+ editButton.classList.add("list-item__element");
+ editButton.classList.add("list-item__element_button");
+ editButton.classList.add("list-item__element_button_edit");
+ // editButton.className="list-item__element_button_edit";
+
+ // deleteButton.className="delete";
+ deleteButton.classList.add("list-item__element");
+ deleteButton.classList.add("list-item__element_button_delete");
+ deleteButton.classList.add("list-item__element_button");
+ deleteButtonImg.src="./remove.svg";
+ deleteButtonImg.classList.add("list-item__element_delete_image");
+ deleteButtonImg.setAttribute("alt", "remove task");
deleteButton.appendChild(deleteButtonImg);
@@ -82,10 +103,10 @@ var editTask=function(){
var listItem=this.parentNode;
- var editInput=listItem.querySelector('input[type=text]');
+ var editInput=listItem.querySelector(".list-item__element_text-input");
var label=listItem.querySelector("label");
- var editBtn=listItem.querySelector(".edit");
- var containsClass=listItem.classList.contains("editMode");
+ var editBtn=listItem.querySelector(".list-item__element_button_edit");
+ var containsClass=listItem.classList.contains("list-item_edit-mode");
//If class of the parent is .editmode
if(containsClass){
@@ -99,7 +120,7 @@ var editTask=function(){
}
//toggle .editmode on the parent.
- listItem.classList.toggle("editMode");
+ listItem.classList.toggle("list-item_edit-mode");
};
@@ -155,9 +176,9 @@ addButton.addEventListener("click",ajaxRequest);
var bindTaskEvents=function(taskListItem,checkBoxEventHandler){
console.log("bind list item events");
//select ListItems children
- var checkBox=taskListItem.querySelector("input[type=checkbox]");
- var editButton=taskListItem.querySelector("button.edit");
- var deleteButton=taskListItem.querySelector("button.delete");
+ var checkBox=taskListItem.querySelector(".list-item__element_checkbox");
+ var editButton=taskListItem.querySelector(".list-item__element_button_edit");
+ var deleteButton=taskListItem.querySelector(".list-item__element_button_delete");
//Bind editTask to edit button.
diff --git a/index.html b/index.html
index ef4aa1f60ca..08c6fa86614 100644
--- a/index.html
+++ b/index.html
@@ -1,19 +1,66 @@
-
-
Todo App
-
-
-
-
-
-
-
Todo
-
Completed
-
-
-
+
+
+
+
+
+
+
+
+ Todo App
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/style.css b/style.css
index ab36227705e..522a59996da 100644
--- a/style.css
+++ b/style.css
@@ -1,148 +1,182 @@
/* Basic Style */
-body {
- background-color: #f8f8f8;
- color: #333;
- font-family: Lato, sans-serif;
-}
-.aaa {
- width: 500px;
- margin: 0 auto;
- display: block;
- text-align: right;
-}
-.aaa img {
- width: 100%;
-}
-.aaa .more_inf {
- font-family: fantasy, cursive;
-}
-
-@media (max-width:768px) {
-.aaa { text-align: center;
-}
-}
-.centered-main-page-element {
- display: block;
- width: 500px;
- margin: 0 auto 0;
-}
-.task {
- width: 56%;
- display: inline-block;
- flex-grow: 1
-}
-.task-row-wrapper {
- display: flex;
-}
-ul {
- margin:0;
- padding: 0px;
-}
-li, h3 {
- list-style:none;
-}
-input,button{
- outline:none;
-}
-button {
- background: none;
- border: 0px;
- color: #888;
- font-size: 15px;
- width: 60px;
- font-family: Lato, sans-serif;
- cursor: pointer;
-}
-button:hover {
- color: #3a3A3a;
-}
-/* Heading */
-h3,
-label[for='new-task'] {
- color: #333;
- font-weight: 700;
- font-size: 15px;
- border-bottom: 2px solid #333;
- padding: 30px 0 10px;
- margin: 0;
- text-transform: uppercase;
-}
-input[type="text"] {
- margin: 0;
- font-size: 18px;
- line-height: 18px;
- height: 21px;
- padding: 0 9px;
- border: 1px solid #dDd;
- background: #FFF;
- border-radius: 6px;
- font-family: Lato, sans-serif;
- color: #888;
-}
-input[type="text"]:focus {
- color: #333;
+.body {
+ background-color: #f8f8f8;
+ color: #333;
+ font-family: Lato, sans-serif;
+}
+
+.header {
+ width: 500px;
+ margin: 0 auto;
+ display: block;
+ text-align: right;
+}
+
+.header__img {
+ width: 100%;
+}
+
+.header__link {
+ font-family: fantasy, cursive;
+}
+
+@media (max-width: 768px) {
+
+ .header {
+ text-align: center;
+ }
+}
+
+.main {
+ display: block;
+ width: 500px;
+ margin: 0 auto 0;
+}
+
+.section__list {
+ margin: 0;
+ padding: 0px;
+}
+
+.section_new-task {
+ margin-top: 16px;
+}
+
+.section__title {
+ color: #333;
+ font-weight: 700;
+ font-size: 15px;
+ border-bottom: 2px solid #333;
+ padding: 30px 0 10px;
+ margin: 0;
+ text-transform: uppercase;
+}
+
+.list-item__element_new-task,
+.list-item__element_task {
+ width: 56%;
+ display: inline-block;
+ flex-grow: 1;
+}
+
+.list-item_new-task {
+ display: flex;
+}
+
+.section__list_new-task {
+ padding: 0;
+}
+
+.section__list_new-task,
+.list-item {
+ list-style: none;
+}
+
+.list-item__element_input_new-task,
+.list-item__element_input,
+.list-item__element_button {
+ outline: none;
+}
+
+.list-item__element_button {
+ background: none;
+ border: 0px;
+ color: #888;
+ font-size: 15px;
+ width: 60px;
+ font-family: Lato, sans-serif;
+ cursor: pointer;
+}
+
+.list-item__element_button:hover {
+ color: #3a3a3a;
+}
+
+.list-item__element_input_new-task,
+.list-item__element_text-input {
+ margin: 0;
+ font-size: 18px;
+ line-height: 18px;
+ height: 21px;
+ padding: 0 9px;
+ border: 1px solid #ddd;
+ background: #fff;
+ border-radius: 6px;
+ font-family: Lato, sans-serif;
+ color: #888;
+}
+
+.list-item__element_input_new-task:focus,
+.list-item__element_text-input:focus {
+ color: #333;
}
/* New Task */
-label[for='new-task'] {
- display: block;
- margin: 0 0 20px;
+.section__title_new-task {
+ display: block;
+ margin: 0 0 20px;
}
-input#new-task {
- width: 318px;
+
+.list-item__element_new-task {
+ width: 318px;
}
/* Task list */
-li {
- overflow: hidden;
- padding: 20px 0;
- border-bottom: 1px solid #eee;
+.list-item {
+ overflow: hidden;
+ padding: 20px 0;
+ border-bottom: 1px solid #eee;
- display: flex;
- justify-content: space-between;
- align-items: center;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
}
-li > * {
- vertical-align: middle;
+
+.list-item__element {
+ vertical-align: middle;
}
-li > input[type="checkbox"] {
- margin: 0 10px;
+.list-item__element_checkbox {
+ margin: 0 10px;
}
-li > label {
- padding-left: 10px;
- box-sizing: border-box;
- font-size: 18px;
- width: 226px;
+
+.list-item__element_label {
+ padding-left: 10px;
+ box-sizing: border-box;
+ font-size: 18px;
+ width: 226px;
}
-li > input[type="text"] {
- width: 226px
+
+.list-item__element_text-input {
+ width: 226px;
}
-button.delete img {
- height: 2em;
- transform: rotateZ(45deg);
- transition: transform 200ms ease-in;
+
+.list-item__element_delete_image {
+ height: 2em;
+ transform: rotateZ(45deg);
+ transition: transform 200ms ease-in;
}
-button.delete img:hover {
- transform: rotateZ(0);
+
+.list-item__element_delete_image:hover {
+ transform: rotateZ(0);
}
/* Completed */
-ul#completed-tasks label {
- text-decoration: line-through
- color: #888;
+.section__list_completed .list-item .list-item__element_label {
+ text-decoration: line-through;
+ color: #888;
}
/* Edit Task */
-ul li input[type=text] {
- display:none
+.list-item__element_text-input {
+ display: none;
}
-ul li.editMode input[type=text] {
- display:inline-block;
- width:224px
+.list-item_edit-mode .list-item__element_text-input {
+ display: inline-block;
+ width: 224px;
}
-ul li.editMode label {
- display:none;
+.list-item_edit-mode .list-item__element_label {
+ display: none;
}
\ No newline at end of file