Skip to content
This repository was archived by the owner on Jan 27, 2020. It is now read-only.

Commit e42a0fc

Browse files
committed
Add str-replace function for handling $primary inside SVGs passed to $logo and $admin-bar-logo
1 parent da8de06 commit e42a0fc

File tree

9 files changed

+27
-12
lines changed

9 files changed

+27
-12
lines changed

assets/styles/admin/admin-bar.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
========================================================================== */
44

55
// Configuration
6+
@import '../config/functions';
67
@import '../config/variables';
78
@import '../config/mixins';
89

assets/styles/admin/admin.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
========================================================================== */
44

55
// Configuration
6+
@import '../config/functions';
67
@import '../config/variables';
78
@import '../config/mixins';
89

assets/styles/admin/partials/acf.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@
437437

438438
&::before {
439439
display: block;
440-
background: url($logo) center center no-repeat;
440+
background: str-replace(url($logo), '#', '%23') center center no-repeat;
441441
background-size: contain;
442442
width: 56px;
443443
height: auto;

assets/styles/admin/partials/admin-bar.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
}
134134

135135
&::before {
136-
background: url($admin-bar-logo) center center no-repeat !important;
136+
background: str-replace(url($admin-bar-logo), '#', '%23') center center no-repeat !important;
137137
background-size: contain;
138138
width: $admin-bar-logo-width;
139139
height: $admin-bar-logo-height;

assets/styles/admin/partials/admin-menu.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
#adminmenu li.menu-top .toplevel_page_acf-options-theme-options .wp-menu-image {
3333
&::before {
34-
background: url($logo) center center no-repeat;
34+
background: str-replace(url($logo), '#', '%23') center center no-repeat;
3535
background-size: contain;
3636
width: 16px;
3737
height: 16px;

assets/styles/config/functions.scss

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
///* ==========================================================================
2+
// Functions
3+
// ========================================================================== */
4+
5+
/// Replace `$search` with `$replace` in `$string`
6+
/// Used on our SVG icon backgrounds for custom forms.
7+
/// @param {String} $string
8+
/// @param {String} $search
9+
/// @param {String} $replace
10+
/// @return {String}
11+
12+
@function str-replace($string, $search, $replace: '') {
13+
$index: str-index($string, $search);
14+
15+
@if $index {
16+
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
17+
}
18+
19+
@return $string;
20+
}

assets/styles/config/mixins.scss

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22
// #MIXINS
33
// ========================================================================== */
44

5-
// Responsive, human readable media query
6-
// mixins based on Bulma and Sass MQ.
7-
//
8-
// .usage {
9-
// @include from($desktop) {
10-
// font-size: 2rem;
11-
// }
12-
// }
135
@mixin from($device) {
146
@media screen and (min-width: $device) {
157
@content;

assets/styles/login/login.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
========================================================================== */
44

55
// Configuration
6+
@import '../config/functions';
67
@import '../config/variables';
78
@import '../config/mixins';
89

assets/styles/login/partials/core.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ body.login {
6464
font-size: 0 !important;
6565

6666
&::after {
67-
background: url($logo) center center no-repeat;
67+
background: str-replace(url($logo), '#', '%23') center center no-repeat;
6868
background-size: contain;
6969
width: 48px;
7070
height: 48px;

0 commit comments

Comments
 (0)