On Github dra1n / bem-talk
Nobody knows the future
<ul class="toolbar">
<li class="button edit">
<a href="/edit">Edit</a>
</li>
<li class="button delete">
<a href="/delete">Delete</a>
</li>
</ul>
.button {
display: inline-block;
padding: 5px 10px;
margin: 0 10px;
}
.edit {
padding-left: 20px;
background: url('edit-icon.png');
}
... in some time
<div class="user-profile"> <span class="email">john.doe@example.com</span> <a class="edit">Change email</a> </div>
/* Ooops! */
.edit {
background: url('edit-email-icon.png');
}
.toolbar .edit {
...
}
.toolbar .button {
...
}
.user-profile .edit {
...
}
.toolbar .button .edit
.toolbar__button_edit
<ul class="toolbar">
<li class="toolbar__button toolbar__button_edit">
<a href="/edit">Edit</a>
</li>
<li class="toolbar__button toolbar__button_delete">
<a href="/delete">Delete</a>
</li>
</ul>
.toolbar { ... }
.toolbar__button { ... }
.toolbar__button_edit { ... }
.toolbar__button_delete { ... }
Toolbar is located inside the block header and it should fill its right half
<header class="header">
<div class="header__toolbar">
<ul class="toolbar">
<li class="toolbar__item toolbar__item_edit">
<a href="/edit">Edit</a>
</li>
<li class="toolbar__item toolbar__item_delete">
<a href="/delete">Delete</a>
</li>
</ul>
</div>
</header>
.header { ... }
.header__toolbar {
float: right;
width: 50%;
}
toolbar
toolbar__item toolbar__text "android"
toolbar__item toolbar__button "▼"
toolbar__item toolbar__button "✓ Mark as read"
toolbar__item toolbar__button toolbar__button_toggled "∀ View all"
toolbar__item toolbar__button "↑"
toolbar__item toolbar__button "↓"
toolbar__item toolbar__spacer " "
toolbar__item toolbar__button
toolbar__icon "/errors.svg"
toolbar__item toolbar__button
toolbar__icon "/avatar.jpeg"
toolbar__text "dra1n"
<div class="toolbar">
<div class="toolbar__item toolbar__text">
android
</div>
<a class="toolbar__item toolbar__button">▼</a>
<a class="toolbar__item toolbar__button">✓ Mark as read</a>
<a class="toolbar__item toolbar__button toolbar__button_toggled">
∀ View all
</a>
<a class="toolbar__item toolbar__button">↑</a>
<a class="toolbar__item toolbar__button">↓</a>
<div class="toolbar__item toolbar__spacer"></div>
<a class="toolbar__item toolbar__button">
<img class="toolbar__icon" alt="errors" src="/errors.svg">
</a>
<a class="toolbar__item toolbar__button">
<img class="toolbar__icon" alt="avatar" src="/avatar.jpeg">
<span class="toolbar__text">dra1n</span>
</a>
</div>