Skip to content

Commit 77e6e35

Browse files
committed
Update hub menu elements with template image and foreground colors for icons
1 parent 861fe56 commit 77e6e35

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

WooCommerce/Classes/ViewRelated/Hub Menu/HubMenu.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct HubMenu: View {
3030

3131
LazyVGrid(columns: gridItemLayout, spacing: Constants.itemSpacing) {
3232
ForEach(viewModel.menuElements, id: \.self) { menu in
33-
HubMenuElement(image: menu.icon, text: menu.title, onTapGesture: {
33+
HubMenuElement(image: menu.icon, imageColor: menu.iconColor, text: menu.title, onTapGesture: {
3434
switch menu {
3535
case .woocommerceAdmin:
3636
ServiceLocator.analytics.track(.hubMenuOptionTapped, withProperties: ["option": "admin_menu"])

WooCommerce/Classes/ViewRelated/Hub Menu/HubMenuElement.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import SwiftUI
44
///
55
struct HubMenuElement: View {
66
let image: UIImage
7+
let imageColor: UIColor
78
let text: String
89
let onTapGesture: (() -> Void)
910

@@ -19,8 +20,10 @@ struct HubMenuElement: View {
1920
Color(UIColor(light: .listBackground,
2021
dark: .secondaryButtonBackground))
2122
Image(uiImage: image)
23+
.renderingMode(.template)
2224
.resizable()
2325
.scaledToFit()
26+
.foregroundColor(Color(imageColor))
2427
.frame(width: iconSize, height: iconSize)
2528
}
2629
.frame(width: imageSize, height: imageSize, alignment: .center)
@@ -42,7 +45,9 @@ struct HubMenuElement: View {
4245
struct HubMenuElement_Previews: PreviewProvider {
4346
static var previews: some View {
4447
HubMenuElement(image: .starOutlineImage(),
45-
text: "Menu", onTapGesture: { })
48+
imageColor: .blue,
49+
text: "Menu",
50+
onTapGesture: { })
4651
.previewLayout(.fixed(width: 160, height: 160))
4752
.previewDisplayName("Hub Menu Element")
4853
}

0 commit comments

Comments
 (0)