Skip to content

Commit b240877

Browse files
authored
Refactor + Optimize svg files (#3586)
* Change width and height to be handled by parent context * Optimized SVG files with svgo
1 parent ba543c3 commit b240877

File tree

160 files changed

+890
-1268
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+890
-1268
lines changed

assets/base.css

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,14 @@ h3 .icon-arrow,
634634
transform: translateX(-0.05rem);
635635
}
636636

637+
.svg-wrapper {
638+
display: inline-flex;
639+
justify-content: center;
640+
align-items: center;
641+
width: 20px;
642+
height: 20px;
643+
}
644+
637645
/* base-details-summary */
638646
summary {
639647
cursor: pointer;
@@ -823,7 +831,7 @@ summary::-webkit-details-marker {
823831
align-items: center;
824832
}
825833

826-
.title-wrapper-with-link .link-with-icon svg {
834+
.title-wrapper-with-link .link-with-icon .svg-wrapper {
827835
width: 1.5rem;
828836
}
829837

@@ -1464,7 +1472,7 @@ details[open] > .share-button__fallback {
14641472
color: rgba(var(--color-foreground), 0.75);
14651473
}
14661474

1467-
.share-button__fallback button:hover svg {
1475+
.share-button__fallback button:hover .svg-wrapper {
14681476
transform: scale(1.07);
14691477
}
14701478

@@ -1662,9 +1670,10 @@ details[open] > .share-button__fallback {
16621670

16631671
/* Select */
16641672

1665-
.select .icon-caret,
1666-
.customer select + svg {
1673+
.select .svg-wrapper,
1674+
.customer select + .svg-wrapper {
16671675
height: 0.6rem;
1676+
width: 1rem;
16681677
pointer-events: none;
16691678
position: absolute;
16701679
top: calc(50% - 0.2rem);
@@ -1769,7 +1778,7 @@ details[open] > .share-button__fallback {
17691778
width: 4.4rem;
17701779
}
17711780

1772-
.field__button > svg {
1781+
.field__button > .svg-wrapper {
17731782
height: 2.5rem;
17741783
width: 2.5rem;
17751784
}
@@ -1821,21 +1830,21 @@ input[type='checkbox'] {
18211830
}
18221831

18231832
.form__message .icon,
1824-
.customer .form__message svg {
1833+
.customer .form__message .svg-wrapper {
18251834
flex-shrink: 0;
18261835
height: 1.3rem;
18271836
margin-right: 0.5rem;
18281837
width: 1.3rem;
18291838
}
18301839

18311840
.form__message--large .icon,
1832-
.customer .form__message svg {
1841+
.customer .form__message .svg-wrapper {
18331842
height: 1.5rem;
18341843
width: 1.5rem;
18351844
margin-right: 1rem;
18361845
}
18371846

1838-
.customer .field .form__message svg {
1847+
.customer .field .form__message .svg-wrapper {
18391848
align-self: start;
18401849
}
18411850

@@ -1937,7 +1946,7 @@ input[type='checkbox'] {
19371946
margin-right: calc(var(--inputs-border-width));
19381947
}
19391948

1940-
.quantity__button svg {
1949+
.quantity__button .svg-wrapper {
19411950
width: 1rem;
19421951
pointer-events: none;
19431952
}
@@ -2515,6 +2524,11 @@ input[type='checkbox'] {
25152524
height: 100%;
25162525
}
25172526

2527+
.header__icon .svg-wrapper {
2528+
width: 44px;
2529+
height: 44px;
2530+
}
2531+
25182532
.header__icon::after {
25192533
content: none;
25202534
}
@@ -2558,6 +2572,14 @@ input[type='checkbox'] {
25582572
--shop-avatar-size: 2.8rem;
25592573
}
25602574

2575+
details .header__icon-close {
2576+
display: none;
2577+
}
2578+
2579+
details[open] .header__icon-close {
2580+
display: inline-block;
2581+
}
2582+
25612583
account-icon {
25622584
display: flex;
25632585
}
@@ -3222,7 +3244,7 @@ details-disclosure > details {
32223244
}
32233245

32243246
.animate--zoom-in > img,
3225-
.animate--zoom-in > svg {
3247+
.animate--zoom-in > .svg-wrapper {
32263248
transition: scale var(--duration-short) linear;
32273249
scale: var(--zoom-in-ratio);
32283250
}
@@ -3231,7 +3253,7 @@ details-disclosure > details {
32313253

32323254
@media (prefers-reduced-motion: no-preference) {
32333255
.animate--ambient > img,
3234-
.animate--ambient > svg {
3256+
.animate--ambient > .svg-wrapper {
32353257
animation: animateAmbient 30s linear infinite;
32363258
}
32373259

assets/component-accordion.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
word-break: break-word;
3535
}
3636

37-
.accordion .icon-accordion {
37+
.accordion .svg-wrapper {
3838
align-self: center;
3939
fill: rgb(var(--color-foreground));
4040
height: calc(var(--font-heading-scale) * 2rem);

assets/component-cart-drawer.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ cart-drawer:not(.is-empty) .cart-drawer__collection {
9999
right: 5px;
100100
}
101101

102-
.drawer__close svg {
102+
.drawer__close .svg-wrapper {
103103
height: 2rem;
104104
width: 2rem;
105105
}

assets/component-cart-items.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,15 @@ cart-remove-button .icon-remove {
190190
order: 1;
191191
}
192192

193-
.cart-item__error-text + svg {
193+
.cart-item__error-text + .svg-wrapper {
194194
flex-shrink: 0;
195195
width: 1.5rem;
196196
height: 1.5rem;
197197
margin-right: 0.7rem;
198198
margin-top: 0.25rem;
199199
}
200200

201-
.cart-item__error-text:empty + svg {
201+
.cart-item__error-text:empty + .svg-wrapper {
202202
display: none;
203203
}
204204

assets/component-discounts.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
line-height: calc(1 + 0.5 / var(--font-body-scale));
99
}
1010

11-
.discounts__discount svg {
11+
.discounts__discount .svg-wrapper {
1212
color: rgba(var(--color-button), var(--alpha-button-background));
1313
}
1414

assets/component-facets.css

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@
195195
margin-bottom: 1.5rem;
196196
}
197197

198+
.facets__summary .svg-wrapper {
199+
height: auto;
200+
width: auto;
201+
}
202+
198203
.facets__disclosure fieldset {
199204
padding: 0;
200205
margin: 0;
@@ -211,7 +216,7 @@
211216
animation: animateMenuOpen var(--duration-default) ease;
212217
}
213218

214-
.facets__summary span {
219+
.facets__summary span:first-of-type {
215220
transition: text-decoration var(--duration-short) ease;
216221
}
217222

@@ -498,21 +503,24 @@
498503
display: flex;
499504
}
500505

501-
.facet-checkbox > svg {
506+
.facet-checkbox > svg,
507+
.facet-checkbox > .svg-wrapper {
502508
background-color: rgb(var(--color-background));
503509
margin-right: 1.2rem;
504510
flex-shrink: 0;
505511
}
506512

507-
.facet-checkbox .icon-checkmark {
513+
.facet-checkbox .svg-wrapper {
508514
visibility: hidden;
509515
position: absolute;
510516
left: 0.3rem;
511517
z-index: 5;
512518
top: 1.4rem;
519+
width: 1.1rem;
520+
height: 0.7rem;
513521
}
514522

515-
.facet-checkbox > input[type='checkbox']:checked ~ .icon-checkmark {
523+
.facet-checkbox > input[type='checkbox']:checked ~ .svg-wrapper > .icon-checkmark {
516524
visibility: visible;
517525
}
518526

@@ -522,7 +530,7 @@
522530
border: 0.1rem solid rgb(var(--color-background));
523531
}
524532

525-
.facet-checkbox > input[type='checkbox']:checked ~ .icon-checkmark {
533+
.facet-checkbox > input[type='checkbox']:checked ~ .svg-wrapper > .icon-checkmark {
526534
border: none;
527535
}
528536
}
@@ -676,7 +684,7 @@ a.active-facets__button.focused .active-facets__button-inner {
676684
outline: none;
677685
}
678686

679-
.active-facets__button svg {
687+
.active-facets__button .svg-wrapper {
680688
align-self: center;
681689
flex-shrink: 0;
682690
margin-left: 0.6rem;
@@ -686,7 +694,7 @@ a.active-facets__button.focused .active-facets__button-inner {
686694
}
687695

688696
@media all and (min-width: 990px) {
689-
.active-facets__button svg {
697+
.active-facets__button .svg-wrapper {
690698
margin-right: -0.4rem;
691699
margin-top: 0.1rem;
692700
width: 1.4rem;
@@ -848,7 +856,7 @@ a.active-facets__button.focused .active-facets__button-inner {
848856
margin-left: 1rem;
849857
}
850858

851-
.mobile-facets__open svg {
859+
.mobile-facets__open .svg-wrapper {
852860
width: 2rem;
853861
}
854862

@@ -871,7 +879,7 @@ a.active-facets__button.focused .active-facets__button-inner {
871879
transition: opacity var(--duration-short) ease;
872880
}
873881

874-
.mobile-facets__close svg {
882+
.mobile-facets__close .svg-wrapper {
875883
width: 2.2rem;
876884
}
877885

@@ -880,7 +888,7 @@ details.menu-opening .mobile-facets__close {
880888
opacity: 1;
881889
}
882890

883-
details.menu-opening .mobile-facets__close svg {
891+
details.menu-opening .mobile-facets__close .svg-wrapper {
884892
margin: 0;
885893
}
886894

@@ -943,7 +951,7 @@ details.menu-opening .mobile-facets__close svg {
943951
padding: 1.3rem 2.5rem;
944952
}
945953

946-
.mobile-facets__summary svg {
954+
.mobile-facets__summary .svg-wrapper {
947955
margin-left: auto;
948956
}
949957

@@ -1007,7 +1015,7 @@ input.mobile-facets__checkbox {
10071015
display: flex;
10081016
}
10091017

1010-
.mobile-facets__label > svg {
1018+
.mobile-facets__label > .svg-wrapper {
10111019
background-color: rgb(var(--color-background));
10121020
position: relative;
10131021
z-index: 2;

assets/component-image-with-text.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
}
6565
}
6666

67-
.image-with-text__media--placeholder > svg {
67+
.image-with-text__media--placeholder > .svg-wrapper {
6868
position: absolute;
6969
left: 50%;
7070
top: 50%;
@@ -74,7 +74,7 @@
7474
fill: currentColor;
7575
}
7676

77-
.image-with-text__media--placeholder:is(.animate--ambient, .animate--zoom-in) > svg {
77+
.image-with-text__media--placeholder:is(.animate--ambient, .animate--zoom-in) > .svg-wrapper {
7878
top: 0;
7979
left: 0;
8080
transform: translate(0);

assets/component-localization-form.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@
176176
z-index: 6;
177177
}
178178

179+
.country-filter__input {
180+
min-width: 200px;
181+
}
182+
179183
.country-filter__reset-button,
180184
.country-filter__search-icon {
181185
right: calc(var(--inputs-border-width));

assets/component-menu-drawer.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ details[open].menu-opening > .menu-drawer__submenu {
203203
margin: 0;
204204
}
205205

206-
.menu-drawer__account .icon-account {
206+
.menu-drawer__account account-icon > .svg-wrapper {
207207
height: 2rem;
208208
width: 2rem;
209209
margin-right: 1rem;
@@ -215,7 +215,7 @@ details[open].menu-opening > .menu-drawer__submenu {
215215
margin-left: -0.45rem;
216216
}
217217

218-
.menu-drawer__account:hover .icon-account {
218+
.menu-drawer__account:hover account-icon > .svg-wrapper {
219219
transform: scale(1.07);
220220
}
221221

assets/component-slideshow.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ slideshow-component:not(.page-width) .slider-buttons {
189189
}
190190
}
191191

192-
.slideshow__autoplay:hover svg {
192+
.slideshow__autoplay:hover .svg-wrapper {
193193
transform: scale(1.1);
194194
}
195195

0 commit comments

Comments
 (0)