Skip to content

Commit 4869821

Browse files
committed
IMP: scss version with less version changes
1 parent 4663493 commit 4869821

File tree

1 file changed

+61
-16
lines changed

1 file changed

+61
-16
lines changed

view/frontend/styles/_module.scss

Lines changed: 61 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,54 @@
1-
$modal-added-to-cart-offset: 20px;
2-
$modal-added-to-cart-max-width: 480px;
3-
$modal-added-to-cart-padding: ($modal-popup__padding / 2);
4-
$modal-added-to-cart-bg: $modal__background-color;
5-
$modal-added-to-cart-color: inherit;
6-
$modal-added-to-cart-box-shadow: $modal__box-shadow;
1+
$modal-add-to-cart-mobile-position: "bottom" !default;
2+
$modal-add-to-cart-mobile-offset: 1em !default;
3+
$modal-add-to-cart-desktop-position: "top" !default;
4+
$modal-add-to-cart-desktop-offset: 1.5em !default;
5+
6+
$modal-add-to-cart-index: $modal__z-index !default;
7+
$modal-add-to-cart-max-width: 480px !default;
8+
$modal-add-to-cart-padding: 1rem !default;
9+
$modal-add-to-cart-radius: 0.2rem !default;
10+
$modal-add-to-cart-bg: $modal__background-color !default;
11+
$modal-add-to-cart-color: inherit !default;
12+
$modal-add-to-cart-box-shadow: $modal__box-shadow !default;
13+
14+
@mixin modal-added-to-cart-position($position, $offset) {
15+
@if ($position == "top") {
16+
top: $offset;
17+
bottom: auto;
18+
}
19+
20+
@if ($position == "bottom") {
21+
top: auto;
22+
bottom: $offset;
23+
}
24+
}
25+
26+
@keyframes modal-added-to-cart-show {
27+
from {
28+
opacity: 0;
29+
transition: translateY(var(--modal-offset-from, -100%));
30+
}
31+
}
732

833
.modal-added-to-cart {
9-
z-index: 9;
34+
@include modal-added-to-cart-position(
35+
$position: $modal-add-to-cart-mobile-position,
36+
$offset: $modal-add-to-cart-mobile-offset
37+
);
38+
box-sizing: border-box;
39+
z-index: $modal-add-to-cart-index;
1040
position: fixed;
11-
top: 0;
1241
right: 0;
13-
bottom: auto;
1442
left: 0;
15-
max-width: $modal-added-to-cart-max-width;
43+
max-width: $modal-add-to-cart-max-width;
44+
width: calc(100% - #{($modal-add-to-cart-mobile-offset * 2)});
1645
margin: 0 auto;
17-
padding: $modal-added-to-cart-padding;
18-
background-color: $modal-added-to-cart-bg;
19-
color: $modal-added-to-cart-color;
20-
box-shadow: $modal-added-to-cart-box-shadow;
46+
padding: $modal-add-to-cart-padding;
47+
border-radius: $modal-add-to-cart-radius;
48+
background-color: $modal-add-to-cart-bg;
49+
color: $modal-add-to-cart-color;
50+
box-shadow: $modal-add-to-cart-box-shadow;
51+
animation: modal-added-to-cart-show 500ms;
2152

2253
.modal-content {
2354
display: flex;
@@ -29,6 +60,17 @@ $modal-added-to-cart-box-shadow: $modal__box-shadow;
2960
flex: 0 0 auto;
3061
width: 50px;
3162
margin-right: 1em;
63+
64+
> img {
65+
vertical-align: middle;
66+
}
67+
}
68+
69+
.nav-open &,
70+
.filter-active & {
71+
opacity: 0;
72+
visibility: hidden;
73+
transition: opacity 200ms, visibility 0s 200ms;
3274
}
3375
}
3476

@@ -42,7 +84,10 @@ $modal-added-to-cart-box-shadow: $modal__box-shadow;
4284

4385
@include min-screen($screen__m) {
4486
.modal-added-to-cart {
45-
top: $modal-added-to-cart-offset;
87+
@include modal-added-to-cart-position(
88+
$position: $modal-add-to-cart-desktop-position,
89+
$offset: $modal-add-to-cart-desktop-offset
90+
);
91+
width: calc(100% - #{($modal-add-to-cart-desktop-offset * 2)});
4692
}
4793
}
48-

0 commit comments

Comments
 (0)