Commit 87c3971a authored by Nikolay Gromov's avatar Nikolay Gromov

Merge branch 'master' of github.com:nicothin/NTH-start-project

parents 03d62dc1 5b3e9259
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
"tfoot", "tfoot",
"thead", "thead",
"noUiSlider", "noUiSlider",
"dropdown",
"cleancss" "cleancss"
] ]
} }
...@@ -50,7 +50,9 @@ ...@@ -50,7 +50,9 @@
"off-canvas": [], "off-canvas": [],
"burger": [], "burger": [],
"progress": [], "progress": [],
"media": [] "media": [],
"modal": [],
"close": []
}, },
"addCssBefore": [ "addCssBefore": [
"./src/scss/variables.scss", "./src/scss/variables.scss",
......
...@@ -1492,6 +1492,8 @@ ...@@ -1492,6 +1492,8 @@
<h2 class="blocks-library__item-title">Выпадающий блок</h2> <h2 class="blocks-library__item-title">Выпадающий блок</h2>
<p>Основан на dropdown.js из Bootstrap. Изменения минимальны.</p>
<p class="alert alert--warning">Зависит от <a href="https://jquery.com/">jQuery</a> (включен в сборку по умолчанию).</p> <p class="alert alert--warning">Зависит от <a href="https://jquery.com/">jQuery</a> (включен в сборку по умолчанию).</p>
<div class="dropdown"> <div class="dropdown">
...@@ -1789,6 +1791,76 @@ ...@@ -1789,6 +1791,76 @@
</section> </section>
<section class="blocks-library__item" id="modal-demo" data-name=".modal">
<h2 class="blocks-library__item-title">Модальные окна</h2>
<p>Основан на modal.js из Bootstrap. Изменения минимальны (имена классов, пространство имен событий, некоторые упрощения).</p>
<p class="alert alert--warning">Зависит от <a href="https://jquery.com/">jQuery</a> (включен в сборку по умолчанию).</p>
<button class="btn" type="button" data-toggle="modal" data-target="#modal-demo-01">Показать модальное окно 1</button>
<a href="#modal-demo-02" data-toggle="modal">Показать модальное окно 2</a>
<span data-toggle="modal" data-target="#modal-demo-03">Показать модальное окно 3</span>
<p>
Методы:
</p>
<pre class="code">
<code>$('#modal-demo-01').modal(options)</code>
<code onclick="$('#modal-demo-01').modal('show');">$('#modal-demo-01').modal('show')</code>
<code onclick="$('#modal-demo-01').modal('hide');">$('#modal-demo-01').modal('hide')</code>
<code onclick="$('#modal-demo-01').modal('toggle');">$('#modal-demo-01').modal('toggle')</code>
</pre>
<p>
События:
</p>
<pre class="code">
<code>$('#modal-demo-01').on('show.nth.modal', function(){</code>
<code> console.log('show.nth.modal');</code>
<code>});</code>
<code>$('#modal-demo-01').on('shown.nth.modal', function(){</code>
<code> console.log('shown.nth.modal');</code>
<code>});</code>
<code>$('#modal-demo-01').on('hide.nth.modal', function(){</code>
<code> console.log('hide.nth.modal');</code>
<code>});</code>
<code>$('#modal-demo-01').on('hidden.nth.modal', function(){</code>
<code> console.log('hidden.nth.modal');</code>
<code>});</code>
</pre>
<div class="blocks-library__code-wrapper">
<span class="blocks-library__code-show-trigger" title="Показать код"><i class="blocks-library__code-icon"></i></span>
<div class="blocks-library__code">
<pre class="code">
<code>&lt;button class="btn" type="button" data-toggle="modal" data-target="#modal-demo-01">Показать модальное окно 1&lt;/button></code>
<code>&lt;a href="#modal-demo-01" data-toggle="modal">Показать модальное окно 2&lt;/a></code>
<code>&lt;span data-toggle="modal" data-target="#modal-demo-01">Показать модальное окно 3&lt;/span></code>
<code> </code>
<code>&lt;div id="modal-demo-01" class="modal" tabindex="-1" role="dialog"></code>
<code> &lt;div class="modal__dialog" role="document"></code>
<code> &lt;div class="modal__content"></code>
<code> &lt;div class="modal__header"></code>
<code> &lt;span class="close modal__close" data-dismiss="modal" aria-label="Закрыть">&lt;span>&lt;/span>&lt;/span></code>
<code> &lt;h4 class="modal__title">Modal 01 title&lt;/h4></code>
<code> &lt;/div></code>
<code> &lt;div class="modal__body">...&lt;/div></code>
<code> &lt;div class="modal__footer"></code>
<code> &lt;button type="button" class="btn" data-dismiss="modal">Закрыть&lt;/button></code>
<code> &lt;/div></code>
<code> &lt;/div></code>
<code> &lt;/div></code>
<code>&lt;/div></code>
</pre>
</div>
</div>
</section>
<div class="burger blocks-library__menu-toggler" data-toggle="off-canvas"><span data-toggle="off-canvas"></span></div> <div class="burger blocks-library__menu-toggler" data-toggle="off-canvas"><span data-toggle="off-canvas"></span></div>
</main> </main>
...@@ -1859,7 +1931,82 @@ ...@@ -1859,7 +1931,82 @@
var offCanvasMenuContent = document.getElementById('off-canvas-menu'); var offCanvasMenuContent = document.getElementById('off-canvas-menu');
offCanvasMenuContent.innerHTML = offCanvasMenu; offCanvasMenuContent.innerHTML = offCanvasMenu;
$('#modal-demo-01').on('show.nth.modal', function(){
console.log('show.nth.modal');
});
$('#modal-demo-01').on('shown.nth.modal', function(){
console.log('shown.nth.modal');
});
$('#modal-demo-01').on('hide.nth.modal', function(){
console.log('hide.nth.modal');
});
$('#modal-demo-01').on('hidden.nth.modal', function(){
console.log('hidden.nth.modal');
});
}); });
</script> </script>
<div id="modal-demo-01" class="modal" tabindex="-1" role="dialog">
<div class="modal__dialog" role="document">
<div class="modal__content">
<div class="modal__header">
<span class="close modal__close" data-dismiss="modal" aria-label="Закрыть"><span></span></span>
<h4 class="modal__title">Modal 01 title</h4>
</div>
<div class="modal__body">
<p>Далеко-далеко за словесными горами...</p>
<p>Далеко-далеко за словесными горами...</p>
<p>Далеко-далеко за словесными горами...</p>
<p>Далеко-далеко за словесными горами...</p>
<p>Далеко-далеко за словесными горами...</p>
<p>Далеко-далеко за словесными горами...</p>
<p>Далеко-далеко за словесными горами...</p>
<p>Далеко-далеко за словесными горами...</p>
<p>Далеко-далеко за словесными горами...</p>
<p>Далеко-далеко за словесными горами...</p>
<p>Далеко-далеко за словесными горами...</p>
</div>
<div class="modal__footer">
<button type="button" class="btn" data-dismiss="modal">Закрыть</button>
</div>
</div>
</div>
</div>
<div id="modal-demo-02" class="modal" tabindex="-1" role="dialog">
<div class="modal__dialog" role="document">
<div class="modal__content">
<div class="modal__header">
<span class="close modal__close" data-dismiss="modal" aria-label="Закрыть"><span></span></span>
<h4 class="modal__title">Modal 02 title</h4>
</div>
<div class="modal__body">
<p>Далеко-далеко за словесными горами...</p>
</div>
<div class="modal__footer">
<button type="button" class="btn" data-dismiss="modal">Закрыть</button>
</div>
</div>
</div>
</div>
<div id="modal-demo-03" class="modal" tabindex="-1" role="dialog">
<div class="modal__dialog" role="document">
<div class="modal__content">
<div class="modal__header">
<span class="close modal__close" data-dismiss="modal" aria-label="Закрыть"><span></span></span>
<h4 class="modal__title">Modal 03 title</h4>
</div>
<div class="modal__body">
<p>Далеко-далеко за словесными горами...</p>
</div>
<div class="modal__footer">
<button type="button" class="btn" data-dismiss="modal">Закрыть</button>
</div>
</div>
</div>
</div>
</body> </body>
</html> </html>
<!--DEV
Для использования этого файла как шаблона:
@ @include('blocks/close/close.html')
(Нужно убрать пробел между символами @)
Подробнее: https://www.npmjs.com/package/gulp-file-include
-->
<span class="close" aria-label="Закрыть"><span></span></span>
// В этом файле должны быть стили только для БЭМ-блока close, его элементов,
// модификаторов, псевдоселекторов, псевдоэлементов, @media-условий...
// Не пишите здесь другие селекторы.
$toggler-part-height: 3px !default;
$toggler-part-bg-color: #000 !default;
.close {
position: relative;
z-index: 1;
display: flex;
align-items: center;
width: 30px;
height: 30px;
user-select: none;
cursor: pointer;
> span {
display: inline-block;
width: 100%;
height: $toggler-part-height;
background: transparent;
position: relative;
&:before,
&:after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: $toggler-part-height;
background: $toggler-part-bg-color;
transform-origin: 50% 50%;
}
&:before {
transform: rotate3d(0, 0, 1, 45deg);
}
&:after {
transform: rotate3d(0, 0, 1, -45deg);
}
}
}
<!--DEV
Для использования этого файла как шаблона:
@ @include('blocks/modal/modal.html')
(Нужно убрать пробел между символами @)
Подробнее: https://www.npmjs.com/package/gulp-file-include
-->
<div class="modal">content</div>
This diff is collapsed.
// В этом файле должны быть стили только для БЭМ-блока modal, его элементов,
// модификаторов, псевдоселекторов, псевдоэлементов, @media-условий...
// Не пишите здесь другие селекторы.
$font-family: -apple-system, BlinkMacSystemFont, 'Roboto', 'Ubuntu', 'Droid Sans', 'Helvetica Neue', 'Arial', sans-serif !default;
$font-family--headings: $font-family !default;
$font-size--h4: 1.25em !default;
$line-height: 1.375em !default;
$screen-lg: 992px !default;
$opacity: 0.7 !default;
$transition-time: 0.3s !default;
$z-index-modal: 100 !default;
.js-modal-open {
overflow: hidden;
}
.modal {
$block-name: &;
display: none;
overflow: hidden;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: $z-index-modal;
-webkit-overflow-scrolling: touch;
.js-modal-open & {
overflow-x: hidden;
overflow-y: auto;
}
&__dialog {
position: relative;
margin: 0;
width: 100%;
height: 100%;
@media (min-width: $screen-lg) {
width: 600px;
height: auto;
#{$block-name}--open & {
animation: modal-content-show $transition-time 1 both;
}
}
}
&__content {
position: relative;
display: flex;
flex-direction: column;
min-width: 100%;
min-height: 100%;
background-color: #fff;
outline: 0;
}
&__header {
padding: 5px 40px 0 10px;
flex-shrink: 0;
}
&__title {
margin-top: ($line-height / 2);
margin-bottom: ($line-height / 2);
font-size: $font-size--h4;
line-height: 1.4;
font-weight: 700;
color: currentColor;
}
&__close {
position: absolute !important;
top: 5px;
right: 5px;
}
&__body {
padding: 0 10px;
flex-grow: 1;
}
&__footer {
padding: 10px;
flex-shrink: 0;
}
&__backdrop {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: ($z-index-modal - 1);
background-color: rgba(0, 0, 0, $opacity);
@media (min-width: $screen-lg) {
animation: modal-backdrop-show $transition-time 1;
}
}
&--open {
@media (min-width: $screen-lg) {
display: flex;
justify-content: center;
align-items: center;
}
}
}
@keyframes modal-backdrop-show {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes modal-content-show {
0% {
opacity: 0;
transform: translateY(-2em);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
} }
} }
.page { .page { // html
box-sizing: border-box; box-sizing: border-box;
font-size: 10px; font-size: 10px;
-webkit-tap-highlight-color: rgba(0, 0, 0, 1); -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-ms-overflow-style: scrollbar; -ms-overflow-style: scrollbar;
-ms-text-size-adjust: 100%; /* stylelint-disable-line property-no-vendor-prefix */ -ms-text-size-adjust: 100%; /* stylelint-disable-line property-no-vendor-prefix */
min-width: 320px; min-width: 320px;
......
// Этот блок ответственнен за типографике проекта. // Этот блок ответственнен за типографику проекта.
// Не пишите тут какую-либо стороннюю стилизацию. // Не пишите тут какую-либо стороннюю стилизацию.
$gray: hsl(0, 0%, 50%) !default; $gray: hsl(0, 0%, 50%) !default;
......
...@@ -89,3 +89,5 @@ $shadow: 0 4px 2px -2px rgba(0, 0, 0, 0.3); ...@@ -89,3 +89,5 @@ $shadow: 0 4px 2px -2px rgba(0, 0, 0, 0.3);
$menu-desktop-width: $screen-xl; $menu-desktop-width: $screen-xl;
$toggler-part-height: 3px; $toggler-part-height: 3px;
$toggler-part-bg-color: #000; $toggler-part-bg-color: #000;
$z-index-modal: 100;
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