Commit 2bf9a44f authored by Nikolay Gromov's avatar Nikolay Gromov

Адаптивность Навбара

parent d92a6e2d
......@@ -7,11 +7,20 @@
&__list {
padding: 0;
margin: 0;
list-style: none;
display: none;
@media (min-width: @screen-lg) {
display: flex;
flex-wrap: wrap;
}
&--level-2 {
display: none;
@media (min-width: @screen-lg) {
display: none;
}
}
}
......
// Переключение открытого/закрытого положений navbar
document.getElementById('navbar-toggler').addEventListener('click', function(){
this.closest('.navbar').classList.toggle('navbar--open');
});
......@@ -7,26 +7,58 @@
padding: 0.6rem;
background-color: @gray-lightest;
&--open {
// Меняем внешний вид иконки
.navbar__toggler-icon {
transition: background 0.2s 0;
background: transparent;
&:before,
&:after {
transition: top 0.2s, transform 0.2s 0.2s;
top: 0;
}
&:before {
transform: rotate3d(0, 0, 1, 45deg);
}
&:after {
transform: rotate3d(0, 0, 1, -45deg);
}
}
// Показываем скрытый элемент (если JS работает, иначе он и так виден)
.js & .navbar__slidable-content {
height: auto;
max-height: 90vh;
}
}
&__inner {
.container();
display: flex;
align-items: flex-start;
justify-content: space-between;
}
&__left {
margin-right: 1em;
@media (min-width: @screen-lg) {
display: flex;
align-items: center;
justify-content: space-between;
}
}
&__right {
flex-grow: 1;
&__left {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
justify-content: space-between;
@media (min-width: @screen-lg) {
justify-content: flex-start;
margin-right: 2rem;
}
}
&__right {
@media (min-width: @screen-lg) {
flex-grow: 1;
}
}
......@@ -61,7 +93,7 @@
background: currentColor;
border-radius: 0.2rem;
position: relative;
transition: background 0.3s 0.3s;
transition: background 0.2s 0.2s;
&:before,
&:after {
......@@ -73,7 +105,7 @@
left: 0;
content: '';
transform-origin: 50% 50%;
transition: top 0.3s 0.3s, transform 0.3s;
transition: top 0.2s 0.2s, transform 0.2s;
}
&:before {
......@@ -83,45 +115,48 @@
&:after {
top: -1rem;
}
}
&__toggler-checkbox {
&:checked {
& ~ .navbar__toggler .navbar__toggler-icon {
transition: background .3s 0;
background: transparent;
&:before,
&:after {
transition: top 0.3s, transform 0.3s 0.3s;
top: 0;
}
&:before {
transform: rotate3d(0, 0, 1, 45deg);
}
&:after {
transform: rotate3d(0, 0, 1, -45deg);
}
}
&__slidable-content {
transition: all @transition-time;
// Если JS работает, будем скрывать и показывать по клику
.js & {
height: 0;
overflow: hidden;
max-height: 0;
}
& ~ .navbar__content {
display: block;
// На большой ширине показываем вне зависимости от работы JS
.js &,
.no-js & {
@media (min-width: @screen-lg) {
height: auto;
overflow: visible;
max-height: none;
}
}
}
&__content {
display: none;
width: 100%;
& > * {
margin-top: 1rem;
margin-bottom: 1rem;
}
@media (min-width: @screen-lg) {
display: block;
display: flex;
align-items: center;
justify-content: space-between;
& > * {
margin-top: 0;
margin-bottom: 0;
}
}
}
&__form {
.fields-group {
margin-bottom: 0;
}
......
......@@ -26,13 +26,12 @@
<a href="/" class="logo">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100"><rect fill="#F90" width="100" height="100" rx="4" ry="4"/><rect fill="#FFB13B" width="50" height="50" rx="4" ry="4"/><rect x="50" y="50" fill="#DE8500" width="50" height="50" rx="4" ry="4"/><g fill="#F90"><circle cx="50" cy="18.4" r="18.4"/><circle cx="72.4" cy="27.6" r="18.4"/><circle cx="81.6" cy="50" r="18.4"/><circle cx="72.4" cy="72.4" r="18.4"/><circle cx="50" cy="81.6" r="18.4"/><circle cx="27.6" cy="72.4" r="18.4"/><circle cx="18.4" cy="50" r="18.4"/><circle cx="27.6" cy="27.6" r="18.4"/></g><path d="M63.086 18.385c0-7.227-5.86-13.086-13.1-13.086-7.235 0-13.096 5.858-13.096 13.085-5.1-5.11-13.395-5.11-18.497 0-5.12 5.12-5.12 13.408 0 18.524-7.234 0-13.103 5.858-13.103 13.084 0 7.23 5.87 13.098 13.103 13.098-5.12 5.11-5.12 13.395 0 18.515 5.102 5.104 13.397 5.104 18.497 0 0 7.228 5.86 13.083 13.096 13.083 7.24 0 13.1-5.855 13.1-13.083 5.118 5.104 13.416 5.104 18.513 0 5.1-5.12 5.1-13.41 0-18.515 7.215 0 13.08-5.87 13.08-13.098 0-7.227-5.865-13.085-13.08-13.085 5.1-5.12 5.1-13.407 0-18.525-5.098-5.11-13.394-5.11-18.514 0z"/><path fill="#FFF" d="M55.003 23.405v14.488L65.26 27.64c0-1.812.69-3.618 2.066-5.005 2.78-2.77 7.275-2.77 10.024 0 2.77 2.766 2.77 7.255 0 10.027-1.377 1.375-3.195 2.072-5.015 2.072L62.1 44.982h14.49c1.29-1.28 3.054-2.076 5.01-2.076 3.9 0 7.08 3.18 7.08 7.087 0 3.906-3.18 7.088-7.08 7.088-1.956 0-3.72-.797-5.01-2.07H62.1l10.23 10.243c1.823 0 3.64.694 5.014 2.086 2.774 2.758 2.774 7.25 0 10.01-2.75 2.773-7.24 2.773-10.025 0-1.373-1.373-2.065-3.193-2.065-5.004L55 62.094v14.5c1.27 1.275 2.084 3.053 2.084 5.012 0 3.906-3.177 7.077-7.098 7.077-3.92 0-7.094-3.167-7.094-7.077 0-1.96.81-3.732 2.08-5.013v-14.5L34.74 72.347c0 1.812-.705 3.627-2.084 5.003-2.77 2.77-7.25 2.77-10.024 0-2.775-2.765-2.775-7.254 0-10.013 1.377-1.39 3.214-2.086 5.012-2.086L37.9 55.01H23.413c-1.29 1.275-3.072 2.07-5.015 2.07-3.918 0-7.097-3.18-7.097-7.087s3.177-7.087 7.096-7.087c1.94 0 3.724.796 5.014 2.076h14.488L27.646 34.736c-1.797 0-3.632-.697-5.012-2.07-2.775-2.773-2.775-7.26 0-10.028 2.773-2.77 7.256-2.77 10.027 0 1.376 1.386 2.084 3.195 2.084 5.005L44.98 37.895V23.407c-1.27-1.287-2.083-3.053-2.083-5.023 0-3.908 3.175-7.08 7.096-7.08 3.92 0 7.097 3.17 7.097 7.08-.002 1.972-.816 3.735-2.087 5.02z"/><g><path d="M5.3 50h89.38v40q0 5-5 5H10.3q-5 0-5-5z"/><path fill="#3F3F3F" d="M14.657 54.21H86.05c2.91 0 5.313 2.386 5.313 5.316v17.91c-27.584-3.403-54.926-8.125-82.01-7.683V59.526c0-2.93 2.39-5.315 5.304-5.315z"/><path fill="#FFF" stroke="#000" stroke-width=".503" d="M18.312 72.927c-2.103-2.107-3.407-5.028-3.407-8.253 0-6.445 5.223-11.672 11.666-11.672 6.447 0 11.668 5.225 11.668 11.672h-6.832c0-2.674-2.168-4.837-4.835-4.837-2.662 0-4.837 2.163-4.837 4.837 0 1.338.55 2.536 1.415 3.42.883.874 2.1 1.405 3.423 1.405v.01c3.233 0 6.146 1.31 8.244 3.417 2.118 2.11 3.424 5.034 3.424 8.248 0 6.454-5.22 11.68-11.667 11.68-6.44 0-11.665-5.222-11.665-11.68h6.828c0 2.68 2.175 4.835 4.838 4.835 2.668 0 4.836-2.156 4.836-4.835 0-1.33-.545-2.527-1.43-3.407-.863-.88-2.08-1.418-3.405-1.418-3.23 0-6.14-1.314-8.258-3.423zM61.588 53.005l-8.244 39.85h-6.85l-8.258-39.85h6.846l4.838 23.337 4.835-23.337zM73.255 69.513h11.683v11.664c0 6.452-5.226 11.678-11.67 11.678-6.44 0-11.665-5.226-11.665-11.678v-16.5h-.017c0-6.448 5.24-11.677 11.667-11.677 6.46 0 11.683 5.225 11.683 11.676h-6.85c0-2.674-2.15-4.837-4.833-4.837-2.647 0-4.82 2.162-4.82 4.836v16.5c0 2.676 2.173 4.838 4.82 4.838 2.682 0 4.834-2.162 4.834-4.827V76.348h-4.834l.002-6.835z"/></g></svg>
</a>
<span class="navbar__toggler" id="navbar-toggler">
<span class="navbar__toggler-icon"></span>
</span>
</div>
<div class="navbar__right">
<input class="navbar__toggler-checkbox" type="checkbox" id="navbar-toggler" style="display:none!important;">
<label class="navbar__toggler" for="navbar-toggler">
<span class="navbar__toggler-icon"></span>
</label>
<div class="navbar__content">
<div class="navbar__slidable-content">
<nav class="main-nav">
<ul class="main-nav__list">
<li class="main-nav__item">
......@@ -3199,10 +3198,9 @@
<div class="btn-group">
<button class="btn">Отправить</button>
<button class="btn btn--main">Отменить</button>
<button class="btn">Отменить</button>
<span role="presentation" class="dropdown">
<button class="dropdown__toggler btn" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Выпадение от пр. края
Выпадение
</button>
<ul class="dropdown__menu dropdown__menu--right">
<li><a href="#">Пункт списка (выпадает <code>ul</code>)</a></li>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment