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

Dz 02 html #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/
*.iml
Empty file modified README.md
100644 → 100755
Empty file.
Binary file added img/icons/close.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/icons/completed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/icons/select-all.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
119 changes: 81 additions & 38 deletions index.html
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,94 @@
<head>
<meta charset="UTF8">
<title>TODOS</title>
<link href="./styles/default.css" rel="stylesheet"/>
</head>
<body>
<div class="todos-header">
<h1>TODOS</h1>
</div>
<div class="todos-wrapper">
<div class="todos-input">
<button class="todos-input_select-all" aria-label="Mark all activities as done"></button>
<input placeholder="What needs to be done?" aria-label="Field for input your activities"/>
<div class="main-wrapper">
<div class="todos-header">
todos
</div>
<div class="todos-items-list">
<div class="todos-item">
<input class="todos-item_done_mark" type="checkbox" aria-label="Mark item as done"/>
<textarea class="todos-item_text" aria-label="Mark item"> HTML </textarea>
<button class="todos-item_delete" aria-label="Delete item"></button>
</div>
<div class="todos-item __done">
<input class="todos-item_done_mark" checked= "checked" type="checkbox" aria-label="Mark item as done"/>
<textarea class="todos-item_text" aria-label="Mark item"> CSS </textarea>
<button class="todos-item_delete" aria-label="Delete item"></button>
</div>
<div class="todos-item">
<input class="todos-item_done_mark" type="checkbox" aria-label="Mark item as done"/>
<textarea class="todos-item_text" aria-label="Mark item"> JavaScript </textarea>
<button class="todos-item_delete" aria-label="Delete item"></button>
<div class="todos-wrapper">
<div class="todos-input">
<button class="todos-input_select-all" aria-label="Mark all activities as done">
<div class="todos-input_select-all_icon"></div>
</button>
<div class="todos-input_input-text-wrap">
<input class="todos-input_input-text" placeholder="What needs to be done?"
aria-label="Field for input your activities"/>
</div>
</div>
<div class="todos-item">
<input class="todos-item_done_mark" type="checkbox" aria-label="Mark item as done"/>
<textarea class="todos-item_text" aria-label="Mark item"> JSCode </textarea>
<button class="todos-item_delete" aria-label="Delete item"></button>
</div>
</div>
<div class="todos-items-list">
<div class="todos-item">
<div class="todos-item_done-mark-wrap">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Чекбокс должен быть вынесен в отдельные базовые компоненты и иметь класс элемента блока todos-item

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А в чем минус моего подхода? Сложнее потом до него добираться?

Copy link

@DmitryMakhnev DmitryMakhnev Jan 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно научиться работать с базовыми компонентами и понять принцип их реиспользования

<input class="todos-item_done-mark" type="checkbox" aria-label="Mark item as done"/>

<div class="todos-status-bar">
<div class="todos-status-bar_counter" aria-label="Number of undone tasks">
4 tasks to do
<div class="todos-item_done-mark_visible"></div>
</div>
<button class="todos-item_delete" aria-label="Delete item">
<div class="todos-item_delete_icon"></div>
</button>
<div class="todos-item_text-wrap" >

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

зачем обёртка?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Подумал, что логично распределить пространство с помощью оберток, а в них уже добавлять элементы. на случай, если придется к тексту добавить что-то еще

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше избегать обёрток, пока они не понадобились

<div class="todos-item_text" contenteditable="true">HTML</div>
</div>
</div>
<div class="todos-item __done">
<button class="todos-item_delete" aria-label="Delete item">
<div class="todos-item_delete_icon"></div>
</button>
<div class="todos-item_done-mark-wrap">
<input class="todos-item_done-mark" type="checkbox" checked="checked" aria-label="Mark item as done"/>
<div class="todos-item_done-mark_visible"></div>
</div>
<div class="todos-item_text-wrap" >
<div class="todos-item_text" contenteditable="true">CSS</div>
</div>
</div>
<div class="todos-item">
<button class="todos-item_delete" aria-label="Delete item">
<div class="todos-item_delete_icon"></div>
</button>
<div class="todos-item_done-mark-wrap">
<input class="todos-item_done-mark" type="checkbox" aria-label="Mark item as done"/>
<div class="todos-item_done-mark_visible"></div>
</div>
<div class="todos-item_text-wrap" >
<div class="todos-item_text" contenteditable="true">JS</div>
</div>
</div>
<div class="todos-item">
<button class="todos-item_delete" aria-label="Delete item">
<div class="todos-item_delete_icon"></div>
</button>
<div class="todos-item_done-mark-wrap">
<input class="todos-item_done-mark" type="checkbox" aria-label="Mark item as done"/>
<div class="todos-item_done-mark_visible"></div>
</div>
<div class="todos-item_text-wrap" >
<div class="todos-item_text" contenteditable="true">JSCode</div>
</div>
</div>
</div>
<div class="todos-status-bar_filters">
<button class="todos-filter __marked" aria-label="Show all items" data-filter="all">All</button>
<button class="todos-filter" aria-label="Show done items" data-filter="all">Done</button>
<button class="todos-filter" aria-label="Show undone items" data-filter="all">Undone</button>

<div class="todos-status-bar">
<button class="todos-status-bar_delete-completed" aria-label="Delete completed items">
Delete completed
</button>
<div class="todos-status-bar_counter" aria-label="Number of undone tasks">
4 tasks to do
</div>
<div class="todos-status-bar_filters">
<button class="todos-status-bar_filters_filter __active" aria-label="Show all items" data-filter="all">
<div class="button-text">All</div>
</button>
<button class="todos-status-bar_filters_filter __active" aria-label="Show done items" data-filter="all">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Фильтры должны быть отдельным базовым компонентом
  2. В нашем вексе не может быть 2 модификатора __active

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

по поводу первого пункта - если я его вынесу за пределы todos-status-bar каким образом мне тогда все эти три div'a расположить на одном уровне?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 пункт про нейминг и отлеьный файл стилей

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

«каким образом мне тогда все эти три div'a расположить на одном уровне?»
Посмотрите примеры разбора вёрстки элементов списка. Там такой же лайаут на самом деле

<div class="button-text">Active</div>
</button>
<button class="todos-status-bar_filters_filter" aria-label="Show undone items" data-filter="all">
<div class="button-text">Completed</div>
</button>
</div>
</div>
<button class="todos-status-bar_delete-completed" aria-label="Delete completed items">
Delete completed
</button>
</div>
</div>
</body>
Expand Down
15 changes: 15 additions & 0 deletions styles/base.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
body, input, button, textarea {
font-family: Helvetica Neue, Arial, sans-serif;
font-size: 24px;
}

body {
background: #f5f5f5;
}

.main-wrapper {
max-width: 560px;
min-width: 280px;
margin: 0 auto;
padding: 0 10px;
}
7 changes: 7 additions & 0 deletions styles/default.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@import "reset.css";
@import "base.css";
@import "./project/todos-wrapper/todos-wrapper.css";
@import "./project/todos-header/todos-header.css";
@import "./project/todos-input/todos-input.css";
@import "./project/todos-item.css";
@import "./project/todos-status-bar.css";
6 changes: 6 additions & 0 deletions styles/project/todos-header/todos-header.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.todos-header {
font-size: 100px;
font-weight: 100;
color : rgba(175,47,47,0.15);
text-align: center;
}
49 changes: 49 additions & 0 deletions styles/project/todos-input/todos-input.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
.todos-input {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

наверное это не просто инпут, а больше похоже на добавление, к тому же при таком нейминге получается боль с todos-input_input-text

border-bottom : 1px solid #e6e6e6;
}
.todos-input:after {
content: '';
display: block;
clear: both;
width: 100%;
}
.todos-input_select-all {
width: 60px;
height: 64px;
background: none;
border: none;
padding: 0;
margin: 0;
position: relative;
float: left;
outline: none;
}
.todos-input_select-all_icon {
width: 24px;
height: 12px;
background: url('../../../img/icons/select-all.png') no-repeat 0 0;
position: absolute;
left: 50%;
top: 50%;
margin: -6px -12px;
}
.todos-input_input-text-wrap {
overflow: hidden;
}
.todos-input_input-text {
width: 100%;
border: 0;
background: none;
color: #666;
font-size: 19px;
font-weight: 200;
margin: 19px 0 0 0;
padding-right: 10px;
outline: none;
box-sizing: border-box;
}
.todos-input_input-text::placeholder {
color : #ccc;
font-style: italic;
}

94 changes: 94 additions & 0 deletions styles/project/todos-item.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
.todos-item {
border-bottom: 1px solid #e6e6e6;
min-height: 60px;
display: flex;
overflow: hidden;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем оверфлоу?

}

.todos-item_done-mark-wrap {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем здесь обёртка?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

с помощью нее определяю положение элементов внутри. чтобы и невидимый, и видимый чекбоксы располагать относительно нее

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Чекбокс не бывает невидимым. Калочка бывает скрыта. Надо просто показывать и скрывать её по по псевдоклассу :checked

width: 60px;
height: 60px;
background: none;
float:left;
box-sizing: border-box;
position: relative;
overflow: hidden;
align-self: center;
order: 1;
}
.todos-item_done-mark {
opacity: 0;
width: 50%;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Очень странно: элемент в 50% ширины обёртки

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я подумал, что тогда изменяя размер обертки, например, при изменении размеров всех элементов, за счет того, что они автоматически подстроятся будет проще.
В чем недостаток использования процентных высоты и ширины?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А, кажется понял. Имеется в виду, что он должен быть полностью во всю обертку?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Картинка же не резиновая. Поэтому и не может быть в данном чекбоксе резиновых элементов

height: 50%;
margin: 25%;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не должно быть ни каких процентных марджинов

}

.todos-item_done-mark_visible {
position: absolute;
box-sizing: border-box;
width: 60%;
height: 60%;
margin: 20%;
top: 0;
padding: 10%;
background: none;
border: 1px solid #ccc;
border-radius: 50%;
}
.todos-item.__done .todos-item_done-mark_visible {
background: url("../../img/icons/completed.png") no-repeat center;
/*content: url("../../img/icons/completed.png");*/
border-color: #5dc2af;

}

.todos-item_text-wrap {
overflow: hidden;
position: relative;
align-self: flex-start;
flex: 1 0;
order: 59;
}

.todos-item_text {
resize: none;
width: 100%;
border: 0;
background: none;
color: #666;
font-size: 20px;
font-weight: 200;
padding: 20px 10px 20px 0;
outline: none;
box-sizing: border-box;
}
.todos-item.__done .todos-item_text {
text-decoration:line-through;
color: #ccc;
}
.todos-item_delete {
width: 60px;
height: 60px;
background: none;
border: none;
padding: 0;
margin: 0;
position: relative;
float: right;
align-self: flex-end;
order: 60;
outline: none;
}
.todos-item:hover{
background: #fafafa;
}
.todos-item:hover .todos-item_delete_icon {
opacity: 100;
width: 16px;
height: 16px;
background: url('../../img/icons/close.png') no-repeat 0 0;
position: absolute;
left: 50%;
top: 50%;
margin: -8px -8px;
}
56 changes: 56 additions & 0 deletions styles/project/todos-status-bar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
.todos-status-bar {
position: relative;
bottom: 0;
min-height: 40px;
}

.todos-status-bar_counter {

float: left;
font-size: 12px;
height: 20px;
color: #888;
margin: 10px;
box-sizing: border-box;
line-height: 20px;
}

.todos-status-bar_delete-completed {
float: right;
background: none;
height: 20px;
width: auto;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Игрался с шириной, пытался понять логику работы. почищу

border: none;
padding: 0;
margin: 10px;
outline: none;
font-size: 12px;
color: #888;
vertical-align: middle;
}

.todos-status-bar_filters {
width: 100%;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем?

text-align: center;
}

.todos-status-bar_filters_filter {
color: #888;
font-size: 12px;
background: none;
height: 20px;
border: none;
padding: 0;
margin: 10px;
outline: none;
vertical-align: middle;
}

.button-text {
margin: 0 7px;
}

.todos-status-bar_filters_filter.__active {
border: 1px solid #ebdfdf;
border-radius: 3px;
}
26 changes: 26 additions & 0 deletions styles/project/todos-wrapper/todos-wrapper.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.todos-wrapper {
background: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, .2);
position: relative;
}

.todos-wrapper:after, .todos-wrapper:before {
content: '';
position: absolute;
top: 100%;
background: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, .2);
z-index: -1;
}

.todos-wrapper:before {
height: 10px;
left: 4px;
right: 4px;
}

.todos-wrapper:after {
height: 5px;
left: 2px;
right: 2px;
}
Loading