Skip to content

Commit 48e21d4

Browse files
yulia-dnistrianShaun Maharaj
andauthored
compare UX cleanup (#43)
* compare UX cleanup * add custom keys array to config, create constants for font sizes and breakpoints * - update README Co-authored-by: Shaun Maharaj <Shaun.Maharaj@elasticpath.com>
1 parent 7dac8cc commit 48e21d4

34 files changed

+532
-296
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ Parameters that require configuration are in the `./src/config.ts` file:
8585
|`stripeKey`| Required| String| Stripe publishable API key.|
8686
|`categoryPageSize`| Required| String| Maximum number of products to display on a category page.|
8787
|`maxCompareProducts`| Required| String| Maximum number of products to display in compare view.|
88+
|`compareKeys`| Required| Array| An array of all product attributes to display in compare view.|
8889
|`algoliaAppId`| Required| String| Algolia application identifier.|
8990
|`algoliaApiKey`| Required| String| Algolia API key used to read records.|
9091
|`algoliaIndexName`| Required| String| Name of Algolia index used for search functions.|

src/AccountDropdown.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@
4747
display: inline-block;
4848
padding: 7px 0;
4949
color: $thirdComplimentColor;
50-
font-size: 13px;
50+
font-size: $sizeSmall;
5151
line-height: 19px;
5252
}
5353

5454
&__iteminfo {
55-
font-size: 13px;
55+
font-size: $sizeSmall;
5656
font-weight: bold;
5757
}
5858

5959
&__emailinfo {
60-
font-size: 12px;
60+
font-size: $sizeXSmall;
6161
font-style: italic;
6262
color: $firstComplimentTextColor;
6363
}

src/Address.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
position: relative;
55

66
&__title {
7-
font-size: 24px;
7+
font-size: $sizeLarge;
88
font-weight: bold;
99
}
1010

@@ -20,7 +20,7 @@
2020
&__container {
2121
width: 50%;
2222
margin-bottom: 20px;
23-
@media (max-width: 767px) {
23+
@media (max-width: $mobileWidth - 1px) {
2424
width: 100%;
2525
}
2626
}

src/AddressForm.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
}
1414

1515
&__title {
16-
font-size: 15px;
16+
font-size: $sizeInitialLarger;
1717
}
1818

1919
&__content {
@@ -97,7 +97,7 @@
9797
}
9898
}
9999

100-
@media (max-width: 575px) {
100+
@media (max-width: $mobileSmallWidth - 1px) {
101101
.addressform {
102102
.epform {
103103
&__group {

src/AppFooter.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
&__title {
2121
text-transform: uppercase;
2222
font-weight: bold;
23-
font-size: 16px;
23+
font-size: $sizeMedium;
2424
margin-bottom: 20px;
2525
}
2626

src/Availability.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
@import './theme/common';
2+
13
.availability {
24
display: inline-block;
35
margin-top: 10px;
46
text-transform: uppercase;
5-
font-size: 10px;
7+
font-size: $sizeXXSmall;
68
padding: 5px 10px;
79
border: 1px solid hsl(0, 0, 80%);
810
border-radius: 16px;

src/Category.scss

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#{$block}__breadcrumbs {
1616
margin-top: 20px;
17-
font-size: 15px;
17+
font-size: $sizeInitialLarger;
1818
font-weight: bold;
1919
color: hsl(0, 0%, 45%);
2020

@@ -29,7 +29,7 @@
2929
flex: 0;
3030
margin-top: 20px;
3131
margin-bottom: 80px;
32-
font-size: 26px;
32+
font-size: $sizeXLarge;
3333
font-weight: bold;
3434
}
3535

@@ -54,15 +54,15 @@
5454
align-items: center;
5555
}
5656

57-
@media (min-width: 380px) {
57+
@media (min-width: $mobileXSmallWidth - 101px) {
5858
#{$block}__productlist {
5959
#{$block}__product {
6060
flex: 0 0 50%;
6161
}
6262
}
6363
}
6464

65-
@media (min-width: 576px) {
65+
@media (min-width: $mobileSmallWidth) {
6666
#{$block}__productlist {
6767
width: 540px;
6868

@@ -72,7 +72,7 @@
7272
}
7373
}
7474

75-
@media (min-width: 768px) {
75+
@media (min-width: $mobileWidth) {
7676
#{$block}__productlist {
7777
width: 720px;
7878

@@ -82,12 +82,18 @@
8282
}
8383
}
8484

85-
@media (min-width: 992px) {
85+
@media (min-width: $tabletSmallWidth) {
8686
padding-left: $maxScrollWidth;
8787
padding-right: calc(#{$maxScrollWidth} - 100vw + 100%);
8888

8989
#{$block}__productlist {
9090
width: 800px;
9191
}
9292
}
93+
94+
@media (min-width: $fullHDWidth) {
95+
#{$block}__productlist {
96+
width: 1000px;
97+
}
98+
}
9399
}

src/CompareOverlay.scss

Lines changed: 101 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,45 +8,55 @@ $animLength: 0.2s;
88
$block: &;
99

1010
position: fixed;
11-
width: 100%;
11+
right: 0;
1212
bottom: -100%;
13-
background-color: white;
14-
box-shadow: 0 0 10px hsla(0, 0, 0, 0.3);
1513
transition: bottom 0.1s ease-out;
16-
padding: 10px 15px;
1714
z-index: 10;
18-
display: flex;
19-
align-items: center;
20-
flex-direction: row;
15+
16+
#{$block}__content {
17+
background-color: white;
18+
box-shadow: 0 0 10px hsla(0, 0, 0, 0.3);
19+
padding: 0 25px 25px;
20+
}
2121

2222
&--visible {
2323
bottom: 0;
2424
}
2525

26+
.productmainimage {
27+
width: 100%;
28+
}
29+
2630
#{$block}__products {
27-
flex: 1;
2831
display: flex;
2932
flex-direction: row;
3033
justify-content: center;
3134
flex-wrap: wrap;
35+
padding-top: 50px;
36+
margin-bottom: 10px;
3237

3338
#{$block}__product {
34-
display: flex;
35-
flex-direction: row;
36-
margin: 5px 20px 5px 0;
37-
height: 50px;
38-
width: 175px;
39+
position: relative;
40+
margin: 5px 0 5px;
41+
width: 160px;
3942
box-shadow: 0 0 2px hsla(0, 0, 0, 0.3);
4043

44+
+ #{$block}__product {
45+
margin-left: 20px;
46+
}
47+
4148
#{$block}__productimg {
42-
flex: 0 0 50px;
49+
height: 160px;
50+
width: 160px;
51+
margin-bottom: 10px;
4352
}
4453

4554
#{$block}__productdetails {
4655
flex: 1;
4756
margin-left: 10px;
48-
font-size: smaller;
57+
font-size: $sizeInitial;
4958
align-self: center;
59+
margin-bottom: 10px;
5060

5161
#{$block}__productname {
5262
font-weight: bold;
@@ -61,45 +71,110 @@ $animLength: 0.2s;
6171
}
6272

6373
#{$block}__removeproduct {
64-
flex: 0 0 20px;
74+
position: absolute;
75+
top: -32px;
76+
right: -3px;
6577

6678
button {
79+
padding: 0;
6780
color: hsl(0, 0, 30%);
6881
height: 100%;
6982

83+
&:hover {
84+
background-color: transparent;
85+
}
86+
7087
svg {
7188
width: 20px;
7289
height: 20px;
90+
fill: $buttonActiveColor;
7391
}
7492
}
7593
}
7694
}
7795
}
7896

7997
#{$block}__btns {
80-
flex: 0 0 auto;
98+
min-height: 38px;
8199
display: flex;
82-
flex-direction: column;
100+
flex-direction: row;
101+
justify-content: flex-end;
102+
padding-right: 160px;
83103

84104
button {
85-
margin-bottom: 10px;
105+
min-width: 160px;
106+
}
107+
}
108+
109+
#{$block}__removebtn {
110+
margin-right: 20px;
111+
}
112+
113+
#{$block}__comparebtn {
114+
min-width: 160px;
115+
position: fixed;
116+
right: 25px;
117+
bottom: -100%;
118+
}
119+
120+
&--visible {
121+
#{$block}__comparebtn {
122+
bottom: 25px;
123+
}
124+
}
125+
126+
&--fadeout {
127+
&:not(:hover) {
128+
#{$block}__content {
129+
display: none;
130+
}
86131

87-
&:last-child {
88-
margin-bottom: 0;
132+
#{$block}__btns {
133+
display: none;
89134
}
90135
}
91136
}
92137

93-
@media (min-width: 576px) {
138+
@media (min-width: $tabletSmallWidth) {
94139
#{$block}__products {
95140
#{$block}__product {
96-
width: 200px;
141+
width: 180px;
142+
143+
#{$block}__productimg {
144+
height: 180px;
145+
width: 180px;
146+
}
147+
148+
+ #{$block}__product {
149+
margin-left: 40px;
150+
}
151+
}
152+
}
153+
154+
#{$block}__btns {
155+
padding-right: 180px;
156+
157+
button {
158+
min-width: 180px;
97159
}
98160
}
161+
162+
#{$block}__removebtn {
163+
margin-right: 40px;
164+
}
165+
166+
#{$block}__comparebtn {
167+
min-width: 180px;
168+
}
99169
}
100170

101-
@media (min-width: 768px) {
102-
padding-left: $maxScrollWidth;
103-
padding-right: calc(#{$maxScrollWidth} - 100vw + 100%);
171+
@media (max-width: $mobileWidth - 1px) {
172+
#{$block}__content {
173+
display: none;
174+
}
175+
176+
#{$block}__btns {
177+
display: none;
178+
}
104179
}
105180
}

0 commit comments

Comments
 (0)