Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean code s1e1 #69

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
b97aa6b
style: added two spaces for one indent in html and css files accordin…
shpachela Dec 11, 2024
63486f7
style: converted tags and attributes to lowercase according to rule 1…
shpachela Dec 11, 2024
d12c4f5
style: Used double quotes instead of single quotes for HTML attribute…
shpachela Dec 11, 2024
36eca6a
style: placed each block element on a new line according to rule 2.1 …
shpachela Dec 11, 2024
41ecf9b
fix: add Html5 DOCTYPE tag according to rule 2.2 in html-and-css.md
shpachela Dec 11, 2024
0f7672d
fix: Didn't use links to named characters. according to rule 2.3 in h…
shpachela Dec 11, 2024
2f2b33a
fix: Didn't use type attribute when connecting styles and scripts acc…
shpachela Dec 11, 2024
c48365f
Style: broke long lines into multiple lines according to rule 2.5 in …
shpachela Dec 11, 2024
91b23f5
Style: used single style for naming according to rule 3.1 in html-an…
shpachela Dec 11, 2024
1e192f6
fix: used template or meaningful class names and identifiers accordin…
shpachela Dec 11, 2024
2949583
fix: keeped the names of identifiers and classes concise according to…
shpachela Dec 11, 2024
f7a0e2f
fix: partially filled вon't use tag selectors according to rule 3.4 …
shpachela Dec 11, 2024
25f13ea
style: add indent the contenr of blocks according to rule 3.5 in html…
shpachela Dec 11, 2024
3c00450
style: add space after property name according to rule 3.6 in html-an…
shpachela Dec 11, 2024
746b937
style: add semicolon after properties according to rule 3.7 in html-a…
shpachela Dec 11, 2024
698cf59
style: separated selectors and properties with a line break according…
shpachela Dec 11, 2024
a1528fe
fix: made the code semantic according to rule 1.1 in html-and-css-ext…
shpachela Dec 11, 2024
f3173db
fix: add atribute alt to image according to rule 1.2 in html-and-css-…
shpachela Dec 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

# Application Functionality :

- Adding a new item to the "TODO" task list
- Editing an item in the "TODO" task list
- Deleting an item from the "TODO" task list
- Setting an item to completed status and moving it to the "COMPLETED" list via checkbox

- Deleting an item from the "COMPLETED" list
- Editing an item from the "COMPLETED" list
- Setting an item to "Incomplete" status and moving it to the "TODO" list via checkbox
- Animation on the delete button
- Adding a new item to the "TODO" tasks list.
- Editing an item in the "TODO" tasks list.
- Deleting an item from the "TODO" tasks list.
- Marking an item as "COMPLETED" and moving it to the corresponding list via the checkbox.
- Deleting an item from the "COMPLETED" list.
- Editing an item in the "COMPLETED" list.
- Marking an item as incomplete via the checkbox and moving it into the "TODO" tasks list.
- The appearance of the application has not been changed.
- Alternate text is present for all necessary images.
- The delete button animation works.
6 changes: 3 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

var taskInput=document.getElementById("new-task");//Add a new task.
var addButton=document.getElementsByTagName("button")[0];//first button
var incompleteTaskHolder=document.getElementById("incompleteTasks");//ul of #incompleteTasks
var incompleteTaskHolder=document.getElementById("tasks");//ul of #incompleteTasks
var completedTasksHolder=document.getElementById("completed-tasks");//completed-tasks


Expand Down Expand Up @@ -85,7 +85,7 @@ var editTask=function(){
var editInput=listItem.querySelector('input[type=text]');
var label=listItem.querySelector("label");
var editBtn=listItem.querySelector(".edit");
var containsClass=listItem.classList.contains("editMode");
var containsClass=listItem.classList.contains("edit-mode");
//If class of the parent is .editmode
if(containsClass){

Expand All @@ -99,7 +99,7 @@ var editTask=function(){
}

//toggle .editmode on the parent.
listItem.classList.toggle("editMode");
listItem.classList.toggle("edit-mode");
};


Expand Down
77 changes: 61 additions & 16 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,64 @@
<!DOCTYPE html>
<html>
<HEAD><title>Todo App</title>
<link href='https://fonts.googleapis.com/css?family=Lato:300,400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="style.css" type="text/css" MEDIA="screen" charset="utf-8">
</HEAD>
<body>
<div class="aaa"><img src="./eisenhower-matrix.jpg"><a class='more_inf' href="https://goal-life.com/page/method/matrix-eisenhower">Want more details&quest;</a></div>
<div class="centered-main-page-element"><p id='topSectionForAddingElementToList'><label for="new-task">Add Item</label><div class="task-row-wrapper"><input id='new-task'class="task" type="text"><button>Add</button></div>
</p><h3>Todo</h3>
<ul id='incompleteTasks'>
<li><input type='checkbox'><label class="task">Pay Bills</label><input type="text" class="task"><button class="edit">Edit</button><button class="delete"><img src="./remove.svg"></button></li>
<li class="editMode"><input type="checkbox"><label class="task">Go Shopping</label><input type="text" value="Go Shopping" class="task"><button class='edit'>Save</button><button class="delete"><img src="./remove.svg"></button></li>
</ul><h3>Completed</h3><ul id="completed-tasks"><li><input type="checkbox" checked><label class="task">See the Doctor</label><input type="text" class="task"><button class="edit">Edit</button><button class="delete"><img src="./remove.svg"></button>
</li>
</ul>
</div>
<script type="text/javascript" SRC="app.js"></script>
<head>
<title>Todo App</title>
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700" rel="stylesheet" >
<link rel="stylesheet"
href="style.css"
media="screen"
charset="utf-8"
>
</head>
<body class="page">
<main>
<section class="todo-app__header">
<img src="./eisenhower-matrix.jpg" alt="cartoon app">
<a class="more_inf"
href="https://goal-life.com/page/method/matrix-eisenhower">Want more details?</a>
</section >
<section class="centered-main-page-element">
<p id='add-item'>
<label for="new-task">Add Item</label>
<div class="task-row-wrapper">
<input id="new-task"class="task" type="text">
<button>Add</button>
</div>
</p>
<h3>Todo</h3>
<ul class="list-block" id="tasks">
<li>
<input type="checkbox">
<label class="task">Pay Bills</label>
<input type="text" class="task">
<button class="edit">Edit</button>
<button class="delete">
<img src="./remove.svg" alt="cross logo">
</button>
</li>
<li class="edit-mode">
<input type="checkbox">
<label class="task">Go Shopping</label>
<input type="text" value="Go Shopping" class="task">
<button class="edit">Save</button>
<button class="delete">
<img src="./remove.svg" alt="cross logo">
</button>
</li>
</ul>
<h3>Completed</h3>
<ul class="list-block" id="completed-tasks">
<li>
<input type="checkbox" checked>
<label class="task">See the Doctor</label>
<input type="text" class="task">
<button class="edit">Edit</button>
<button class="delete">
<img src="./remove.svg" alt="cross logo">
</button>
</li>
</ul>
</section >
</main>
<script src="app.js"></script>
</body>
</html>
193 changes: 107 additions & 86 deletions style.css
Original file line number Diff line number Diff line change
@@ -1,148 +1,169 @@
/* Basic Style */
body {
background-color: #f8f8f8;
color: #333;
font-family: Lato, sans-serif;
.page {
background-color: #f8f8f8;
color: #333;
font-family: Lato, sans-serif;
}
.aaa {
width: 500px;
margin: 0 auto;
display: block;
text-align: right;

.todo-app__header {
width: 500px;
margin: 0 auto;
display: block;
text-align: right;
}
.aaa img {
width: 100%;

.todo-app__header img {
width: 100%;
}
.aaa .more_inf {
font-family: fantasy, cursive;

.todo-app__header .more_inf {
font-family: fantasy, cursive;
}

@media (max-width:768px) {
.aaa { text-align: center;
}
.todo-app__header {
text-align: center;
}
}

.centered-main-page-element {
display: block;
width: 500px;
margin: 0 auto 0;
display: block;
width: 500px;
margin: 0 auto 0;
}

.task {
width: 56%;
display: inline-block;
flex-grow: 1
width: 56%;
display: inline-block;
flex-grow: 1;
}

.task-row-wrapper {
display: flex;
display: flex;
}
ul {
margin:0;
padding: 0px;

.list-block {
margin: 0;
padding: 0px;
}
li, h3 {
list-style:none;

li,
h3 {
list-style: none;
}

input,button{
outline:none;
outline: none;
}

button {
background: none;
border: 0px;
color: #888;
font-size: 15px;
width: 60px;
font-family: Lato, sans-serif;
cursor: pointer;
background: none;
border: 0px;
color: #888;
font-size: 15px;
width: 60px;
font-family: Lato, sans-serif;
cursor: pointer;
}

button:hover {
color: #3a3A3a;
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;
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;
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;
color: #333;
}

/* New Task */
label[for='new-task'] {
display: block;
margin: 0 0 20px;
label[for="new-task"] {
display: block;
margin: 0 0 20px;
}

input#new-task {
width: 318px;
width: 318px;
}

/* Task list */
li {
overflow: hidden;
padding: 20px 0;
border-bottom: 1px solid #eee;

display: flex;
justify-content: space-between;
align-items: center;
overflow: hidden;
padding: 20px 0;
border-bottom: 1px solid #eee;
display: flex;
justify-content: space-between;
align-items: center;
}

li > * {
vertical-align: middle;
vertical-align: middle;
}

li > input[type="checkbox"] {
margin: 0 10px;
margin: 0 10px;
}

li > label {
padding-left: 10px;
box-sizing: border-box;
font-size: 18px;
width: 226px;
padding-left: 10px;
box-sizing: border-box;
font-size: 18px;
width: 226px;
}

li > input[type="text"] {
width: 226px
width: 226px;
}

button.delete img {
height: 2em;
transform: rotateZ(45deg);
transition: transform 200ms ease-in;
height: 2em;
transform: rotateZ(45deg);
transition: transform 200ms ease-in;
}

button.delete img:hover {
transform: rotateZ(0);
transform: rotateZ(0);
}

/* Completed */
ul#completed-tasks label {
text-decoration: line-through
color: #888;
text-decoration: line-through;
color: #888;
}

/* Edit Task */
ul li input[type=text] {
display:none
.list-block li input[type=text] {
display: none;
}

ul li.editMode input[type=text] {
display:inline-block;
width:224px
.list-block li.edit-mode input[type=text] {
display: inline-block;
width: 224px;
}

ul li.editMode label {
display:none;
.list-block li.edit-mode label {
display: none;
}