Skip to content

Commit d4aceb8

Browse files
committed
refactor: объединены дублирующиеся стили, удалён мертвый css
1 parent c31562d commit d4aceb8

2 files changed

Lines changed: 34 additions & 40 deletions

File tree

app/static/css/index.css

Lines changed: 27 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -492,16 +492,6 @@ span.error {
492492
z-index: 101;
493493
}
494494

495-
.cart-widget {
496-
width: 300px;
497-
height: 100px;
498-
background-color: white;
499-
position: absolute;
500-
top: 0;
501-
left: 0;
502-
z-index: 1001;
503-
}
504-
505495
.modal {
506496
display: none;
507497
position: fixed;
@@ -607,16 +597,16 @@ span.error {
607597

608598
.cart__item {
609599
display: grid;
610-
grid-template-columns: 1fr 4fr 1fr;
611600
align-items: center;
612601
width: 100%;
613-
background-color: #000000;
614602
border-radius: 8px;
615-
}
616-
617-
.cart__item-title {
618-
font-size: 11px;
619-
font-weight: 900;
603+
grid-template-columns: 70px minmax(0, 1fr) auto;
604+
gap: 12px;
605+
min-height: 76px;
606+
padding: 8px;
607+
background: #fff;
608+
border: 1px solid rgba(36, 25, 19, 0.22);
609+
border-radius: 12px;
620610
}
621611

622612
.cart__item-price {
@@ -690,16 +680,20 @@ span.error {
690680
opacity: 0;
691681
transform: scale(0.8) translateY(0);
692682
}
683+
693684
30% {
694685
opacity: 1;
695686
transform: scale(1.3) translateY(-10px);
696687
}
688+
697689
50% {
698690
transform: scale(1) translateY(0);
699691
}
692+
700693
70% {
701694
transform: scale(1.1) translateY(-4px);
702695
}
696+
703697
100% {
704698
opacity: 1;
705699
transform: scale(1) translateY(0);
@@ -794,21 +788,6 @@ body.modal-open header {
794788
border: 0;
795789
}
796790

797-
.composition {
798-
gap: 10px;
799-
padding: 16px 0;
800-
}
801-
802-
.cart__item {
803-
grid-template-columns: 70px minmax(0, 1fr) auto;
804-
gap: 12px;
805-
min-height: 76px;
806-
padding: 8px;
807-
background: #fff;
808-
border: 1px solid rgba(36, 25, 19, 0.22);
809-
border-radius: 12px;
810-
}
811-
812791
.cart__item-img {
813792
width: 62px;
814793
max-width: none;
@@ -872,6 +851,7 @@ body.modal-open header {
872851
justify-content: flex-end;
873852
background: #f0e6d1;
874853
border-top: 2px solid #241913;
854+
flex-shrink: 0;
875855
}
876856

877857
.modal-cancel {
@@ -886,37 +866,37 @@ body.modal-open header {
886866
.modal {
887867
padding: 16px;
888868
}
869+
889870
.modal-content {
890871
max-height: calc(100dvh - 32px);
891872
border-radius: 14px;
892873
}
874+
893875
.modal-top,
894876
.modal-controls {
895877
padding-inline: 16px;
896-
display: grid;
897-
grid-template-columns: 1fr 1fr;
898-
gap: 10px;
899878
}
879+
900880
.modal-block {
901881
padding-inline: 16px;
902882
}
883+
903884
.cart__item {
904-
grid-template-columns: 54px minmax(0, 1fr);
885+
grid-template-columns: 54px minmax(0, 1fr) auto;
905886
}
887+
906888
.cart__item-img {
907889
width: 48px;
908890
height: 48px;
909891
}
910-
.cart__item-controls {
911-
grid-column: 2;
912-
justify-content: flex-end;
913-
}
892+
914893
.modal-cancel,
915894
.modal-submit {
916895
width: 100%;
917896
padding-inline: 8px;
918897
}
919898
}
899+
920900
.cart__form label,
921901
.delivery-field label {
922902
font-weight: 800;
@@ -1002,6 +982,7 @@ body.modal-open header {
1002982
text-align: center;
1003983
color: rgba(36, 25, 19, 0.7);
1004984
}
985+
1005986
@media (max-width: 1024px) {
1006987
:root {
1007988
--card-max-width: 404px;
@@ -1010,6 +991,7 @@ body.modal-open header {
1010991
.form {
1011992
padding-block: 30px 50px;
1012993
}
994+
1013995
.features__list {
1014996
grid-template-columns: 1fr;
1015997
}
@@ -1029,6 +1011,7 @@ body.modal-open header {
10291011
.feature {
10301012
padding: 2%;
10311013
}
1014+
10321015
.form__container {
10331016
grid-template-columns: 1fr;
10341017
gap: 24px;
@@ -1044,6 +1027,7 @@ body.modal-open header {
10441027
flex-direction: column;
10451028
text-align: center;
10461029
}
1030+
10471031
.form-entry,
10481032
.form-button {
10491033
width: 100%;
@@ -1059,9 +1043,11 @@ body.modal-open header {
10591043
flex-direction: column;
10601044
justify-content: center;
10611045
}
1046+
10621047
.about-us__img {
10631048
max-width: 100%;
10641049
}
1050+
10651051
.form-title,
10661052
.form__info-title,
10671053
.about-us__title,
@@ -1093,6 +1079,7 @@ body.modal-open header {
10931079
from {
10941080
transform: translate(-50%, -50%) rotate(0deg);
10951081
}
1082+
10961083
to {
10971084
transform: translate(-50%, -50%) rotate(360deg);
10981085
}

app/static/js/cart.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { getPhoneMask } from './phoneMask.js';
22

33
function initCart() {
4+
const header = document.querySelector('header');
45
const counter = document.querySelector('.nav__btn');
56
const cards = document.querySelectorAll('.menu__card');
67
const modal = document.querySelector('.modal');
@@ -217,6 +218,9 @@ function initCart() {
217218
function openModal() {
218219
renderModal();
219220
modal.style.display = 'grid';
221+
if (header) {
222+
header.style.display = 'none';
223+
}
220224
document.body.classList.add('modal-open');
221225
requestAnimationFrame(() => modal.classList.add('active'));
222226
}
@@ -226,6 +230,9 @@ function initCart() {
226230
document.body.classList.remove('modal-open');
227231
setTimeout(() => {
228232
modal.style.display = 'none';
233+
if (header) {
234+
header.style.display = 'block';
235+
}
229236
}, 300);
230237
}
231238

0 commit comments

Comments
 (0)