Commit fa2dd835 authored by Evgeny Talagaev's avatar Evgeny Talagaev

some changes, 25.08.2022

parent 9069feaf
...@@ -8,6 +8,7 @@ let config = { ...@@ -8,6 +8,7 @@ let config = {
'no-js', 'no-js',
], ],
'alwaysAddBlocks': [ 'alwaysAddBlocks': [
'form-validation',
// 'sprite-svg', // 'sprite-svg',
// 'sprite-png', // 'sprite-png',
], ],
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
$block-name: &; // #{$block-name}__element $block-name: &; // #{$block-name}__element
display: block; display: block;
margin-bottom: $typo-margin-vertical; margin-bottom: 20px;
&__name { &__name {
@include field-name; @include field-name;
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
&__input-wrap { &__input-wrap {
display: block; display: block;
position: relative;
} }
&__input { &__input {
...@@ -37,12 +38,14 @@ ...@@ -37,12 +38,14 @@
#{$block-name}__name, #{$block-name}__name,
#{$block-name}__input, #{$block-name}__input,
#{$block-name}__help-text { #{$block-name}__help-text {
color: $color-danger;
} }
#{$block-name}__input { #{$block-name}__input {
border-color: $color-danger; box-shadow: 0 0 0 1px #fff;
background-color: lighten($color-danger, 35%); }
#{$block-name}__help-text {
display: block;
} }
} }
} }
...@@ -7,46 +7,46 @@ ready(function () { ...@@ -7,46 +7,46 @@ ready(function () {
const bodyPaddingRightOriginal = parseInt(window.getComputedStyle(document.body, null).getPropertyValue('padding-right')); const bodyPaddingRightOriginal = parseInt(window.getComputedStyle(document.body, null).getPropertyValue('padding-right'));
const backdrop = document.createElement('div'); const backdrop = document.createElement('div');
document.addEventListener('click', function (event) { window.showModal = function (targetModalNode) {
const target = event.target.closest('a[data-modal], button[data-modal]'); if ((document.body.clientHeight - document.documentElement.clientHeight) > 0) {
document.body.style.paddingRight = bodyPaddingRightOriginal + getScrollSize() + 'px';
if (target && target.dataset.modal === 'open') {
showModal( document.getElementById((target.hash || target.dataset.modalTarget).slice(1)) );
} }
document.body.classList.add('modal-open');
if (target && target.dataset.modal === 'close' || event.target.matches('[aria-modal]')) { targetModalNode.classList.add('modal--show');
closeAllModals(); targetModalNode.style.display = 'block';
} targetModalNode.ariaModal = true;
targetModalNode.ariaHidden = null;
targetModalNode.setAttribute('role', 'dialog');
function showModal(targetModalNode) { backdrop.className = 'modal-backdrop';
if ((document.body.clientHeight - document.documentElement.clientHeight) > 0) { document.body.append(backdrop);
document.body.style.paddingRight = bodyPaddingRightOriginal + getScrollSize() + 'px'; }
}
document.body.classList.add('modal-open');
targetModalNode.classList.add('modal--show'); window.closeAllModals = function() {
targetModalNode.style.display = 'block'; document.body.classList.remove('modal-open');
targetModalNode.ariaModal = true; document.body.style.paddingRight = '';
targetModalNode.ariaHidden = null;
targetModalNode.setAttribute('role', 'dialog');
backdrop.className = 'modal-backdrop'; document.querySelectorAll('.modal').forEach(function (modal) {
document.body.append(backdrop); modal.classList.remove('modal--show');
} modal.style.display = 'none';
modal.ariaModal = null;
modal.ariaHidden = true;
modal.removeAttribute('role');
});
function closeAllModals() { backdrop.remove();
document.body.classList.remove('modal-open'); }
document.body.style.paddingRight = '';
document.querySelectorAll('.modal').forEach(function (modal) { document.addEventListener('click', function (event) {
modal.classList.remove('modal--show'); const target = event.target.closest('a[data-modal], button[data-modal]');
modal.style.display = 'none';
modal.ariaModal = null; if (target && target.dataset.modal === 'open') {
modal.ariaHidden = true; window.showModal( document.getElementById((target.hash || target.dataset.modalTarget).slice(1)) );
modal.removeAttribute('role'); }
});
backdrop.remove(); if (target && target.dataset.modal === 'close' || event.target.matches('[aria-modal]')) {
window.closeAllModals();
} }
}); });
......
...@@ -759,7 +759,7 @@ pre { ...@@ -759,7 +759,7 @@ pre {
&__b-item { &__b-item {
padding-top: 40px; padding-top: 40px;
border-top: 1px solid #efefef; border-top: 1px solid #efefef;
counter-increment: li 1; counter-increment: li;
@media (min-width: $screen-xl) { @media (min-width: $screen-xl) {
padding-top: 70px; padding-top: 70px;
...@@ -774,12 +774,11 @@ pre { ...@@ -774,12 +774,11 @@ pre {
margin-top: 40px; margin-top: 40px;
@media (min-width: $screen-xl) { @media (min-width: $screen-xl) {
padding-top: 70px; margin-top: 70px;
} }
@media (min-width: $screen-md) { @media (min-width: $screen-md) {
display: flex; margin-top: 50px;
padding-top: 50px;
} }
} }
} }
...@@ -833,6 +832,7 @@ pre { ...@@ -833,6 +832,7 @@ pre {
border: 1px solid $color-1; border: 1px solid $color-1;
border-radius: 8px; border-radius: 8px;
font-size: 12px; font-size: 12px;
white-space: nowrap;
@media (min-width: $screen-xl) { @media (min-width: $screen-xl) {
font-size: 20px; font-size: 20px;
...@@ -843,7 +843,7 @@ pre { ...@@ -843,7 +843,7 @@ pre {
} }
&::before { &::before {
content: "0" counter(li); content: counter(li, decimal-leading-zero);
} }
} }
...@@ -1039,3 +1039,47 @@ pre { ...@@ -1039,3 +1039,47 @@ pre {
.of-h { .of-h {
overflow: hidden; overflow: hidden;
} }
.response-wrapper,
.response-block {
position: fixed;
opacity: 0;
visibility: hidden;
transition: opacity $transition-time, visibility $transition-time;
&.active {
opacity: 1;
visibility: visible;
}
}
.response-wrapper {
z-index: 10;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.6);
}
.response-block {
z-index: 11;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
padding: 15px;
border-right: 5px solid transparent;
width: 450px;
max-width: calc(100% - 30px);
background-color: #fff;
font: 16px/160% var(--ff);
color: #333;
&.error {
border-color: red;
}
&.ok {
border-color: limegreen;
}
}
...@@ -98,29 +98,32 @@ block content ...@@ -98,29 +98,32 @@ block content
h2.def-title Any questions? <br> Contact us! h2.def-title Any questions? <br> Contact us!
.form-block__second .form-block__second
form(action="", method="post") form(action="test-form.php", method="post", data-check-form, data-ajax, data-ok-msg="Форма успешно отправлена", data-error-msg="При отправке формы возникла ошибка, попробуйте перезагрузить страницу и отправить форму ещё раз")
+field-text({ +field-text({
helpText: 'Подсказка', helpText: 'Only text',
mods: '', mods: '',
attrs: { attrs: {
name: 'name', name: 'name',
placeholder: 'Name', placeholder: 'Name',
'data-check-pattern': '^[а-яА-Яa-zA-Z]{3,30}$',
} }
}) })
+field-text({ +field-text({
helpText: 'Подсказка', helpText: 'Enter e-mail',
mods: '', mods: '',
attrs: { attrs: {
name: 'email', name: 'email',
placeholder: 'E-mail', placeholder: 'E-mail',
'data-check-pattern': '^[a-zA-Z0-9.!#$%&\'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$',
} }
}) })
+field-text({ +field-text({
helpText: 'Подсказка', helpText: 'Enter phone',
mods: '', mods: '',
attrs: { attrs: {
name: 'phone', name: 'phone',
placeholder: 'Phone', placeholder: 'Phone',
'data-check-pattern': '^((8|\\+7|\\+3)[\\- ]?)?(\\(?\\d{3}\\)?[\\- ]?)?[\\d\\- ]{7,15}$',
} }
}) })
+btn('contact us', 'ico')(type="button") +btn('contact us', 'ico')(type="button")
......
...@@ -48,11 +48,12 @@ ...@@ -48,11 +48,12 @@
} }
@mixin field-help-text { @mixin field-help-text {
position: absolute;
display: block; display: block;
padding-top: 0.4em; padding-top: 0.4em;
font-size: $font-size-sm; font-size: $font-size-sm;
line-height: 1.2em; line-height: 1.2em;
color: $text-color-muted; color: #fff;
&:empty { &:empty {
// stylelint-disable-line // stylelint-disable-line
......
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