Skip to content

Commit dc92565

Browse files
authored
Merge pull request #8650 from ProcessMaker/bugfix/FOUR-25084
FOUR-25084: Fix sidebar SVG icons so they inherit nav text color
2 parents c720177 + 347b049 commit dc92565

2 files changed

Lines changed: 44 additions & 3 deletions

File tree

resources/js/components/Sidebaricon.vue

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
<a :href="item.url" class="nav-link" @click="toggle" :target="item.attributes.target" :aria-label="ariaLabel">
44
<i v-if="item.attributes.icon" class="fas nav-icon" :class="item.attributes.icon" ></i>
55
<i v-if="item.attributes.customicon" :class="item.attributes.customicon" ></i>
6-
<img v-if="item.attributes.file" :src="item.attributes.file" class="nav-icon" id="custom_icon">
6+
<span
7+
v-if="item.attributes.file"
8+
class="nav-icon custom-icon"
9+
:style="maskStyle(item.attributes.file)"
10+
id="custom_icon"
11+
/>
712
<span class="nav-text" v-show="expanded()" v-cloak >
813
{{item.title}}
914
<i v-if="item.children && item.children.length" class="float-right fas" :class="{'fa-caret-right': !isOpen, 'fa-caret-down': isOpen}"></i>
@@ -19,7 +24,12 @@
1924
</span>
2025
</a>
2126
<a :href="item.url" class="nav-link" v-show="item.attributes.file">
22-
<img :src="item.attributes.file" class="nav-icon" id="custom_icon"><span class="nav-text" v-if="expanded()" v-cloak>{{item.title}}<span v-if="count !== null" class="nav-badge float-right">{{ count }}</span></span>
27+
<span
28+
:style="maskStyle(item.attributes.file)"
29+
class="nav-icon custom-icon"
30+
id="custom_icon"
31+
/>
32+
<span class="nav-text" v-if="expanded()" v-cloak>{{item.title}}<span v-if="count !== null" class="nav-badge float-right">{{ count }}</span></span>
2333
<span class="nav-text" v-if="expanded()" v-cloak>{{item.title}}
2434
<span v-if="count !== null" class="nav-badge float-right" :aria-label="ariaLabel">{{ count }}</span>
2535
</span>
@@ -73,7 +83,20 @@
7383
},
7484
expanded() {
7585
return this.$parent.expanded
76-
}
86+
},
87+
maskStyle(file) {
88+
return {
89+
backgroundColor: 'currentColor',
90+
WebkitMaskImage: `url(${file})`,
91+
maskImage: `url(${file})`,
92+
WebkitMaskRepeat: 'no-repeat',
93+
maskRepeat: 'no-repeat',
94+
WebkitMaskPosition: 'center',
95+
maskPosition: 'center',
96+
WebkitMaskSize: 'contain',
97+
maskSize: 'contain',
98+
};
99+
}
77100
}
78101
}
79102
</script>

resources/sass/sidebar/sidebar.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,24 @@
4343
font-size: 14px;
4444
color: $light;
4545
height: 43px;
46+
47+
.nav-icon {
48+
color: inherit;
49+
50+
&.custom-icon {
51+
display: inline-block;
52+
width: 24px;
53+
height: 24px;
54+
background-color: currentColor;
55+
}
56+
57+
svg {
58+
width: 1em;
59+
height: 1em;
60+
fill: currentColor;
61+
stroke: currentColor;
62+
}
63+
}
4664
}
4765

4866
.logo {

0 commit comments

Comments
 (0)