Skip to content

Commit 29d1a49

Browse files
authored
[Woo POS][Design System] Consolidate icon style (#15115)
2 parents 46d894f + fc074fd commit 29d1a49

File tree

7 files changed

+41
-21
lines changed

7 files changed

+41
-21
lines changed

WooCommerce/Classes/POS/Presentation/ItemListView.swift

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ private extension ItemListView {
5858
ServiceLocator.analytics.track(.pointOfSaleSimpleProductsExplanationDialogShown)
5959
showSimpleProductsModal = true
6060
}, label: {
61-
Image(systemName: "info.circle")
62-
.font(.posButtonSymbol)
61+
Text(Image(systemName: "info.circle"))
62+
.font(.posButtonSymbolLarge)
6363
})
6464
.foregroundColor(.posOnSurface)
6565
.padding(.trailing, Constants.infoIconPadding)
@@ -76,10 +76,8 @@ private extension ItemListView {
7676
HStack(alignment: .top, spacing: 0) {
7777
VStack {
7878
Spacer()
79-
Image(systemName: "info.circle")
80-
.resizable()
81-
.aspectRatio(contentMode: .fit)
82-
.frame(width: Constants.bannerInfoIconSize, height: Constants.bannerInfoIconSize)
79+
Text(Image(systemName: "info.circle"))
80+
.font(.posButtonSymbolLarge)
8381
.padding(Constants.iconPadding)
8482
.foregroundColor(Color.posOnSurface)
8583
.accessibilityHidden(true)
@@ -103,8 +101,8 @@ private extension ItemListView {
103101
Button(action: {
104102
isHeaderBannerDismissed = true
105103
}, label: {
106-
Image(systemName: "xmark")
107-
.font(.posBodyLargeRegular())
104+
Text(Image(systemName: "xmark"))
105+
.font(.posButtonSymbolSmall)
108106
.foregroundColor(Color.posOnSurfaceVariantLowest)
109107
.accessibilityLabel(Localization.dismissBannerAccessibilityLabel)
110108
})
@@ -226,7 +224,6 @@ private extension ItemListView {
226224
static let bannerTextSpacing: CGFloat = 4
227225
static let bannerTitleSpacing: CGFloat = 8
228226
static let infoIconPadding: CGFloat = 16
229-
static let bannerInfoIconSize: CGFloat = 44
230227
static let iconPadding: CGFloat = 26
231228
static let itemListPadding: CGFloat = 16
232229
static let bannerCardPadding: CGFloat = 16

WooCommerce/Classes/POS/Presentation/ItemRowView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ struct ItemRowView: View {
4242
Button(action: {
4343
onItemRemoveTapped()
4444
}, label: {
45-
Image(systemName: "xmark.circle")
46-
.font(.posBodyLargeRegular())
45+
Text(Image(systemName: "xmark.circle"))
46+
.font(.posButtonSymbolMedium)
4747
})
4848
.accessibilityLabel(Localization.removeFromCartAccessibilityLabel)
4949
.padding(.trailing, Constants.cardContentHorizontalPadding)

WooCommerce/Classes/POS/Presentation/Order Messages/PointOfSaleOrderSyncErrorMessageView.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,8 @@ private extension PointOfSaleOrderSyncErrorMessageView {
3939
static let buttonBottomPadding: CGFloat = 16
4040
}
4141
}
42+
43+
#Preview {
44+
PointOfSaleOrderSyncErrorMessageView(viewModel: PointOfSaleOrderSyncErrorMessageViewModel(message: "An error happened!",
45+
handler: {}))
46+
}

WooCommerce/Classes/POS/Presentation/PointOfSaleExitPosAlertView.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ struct PointOfSaleExitPosAlertView: View {
1515
Button {
1616
isPresented = false
1717
} label: {
18-
Image(systemName: "xmark")
19-
.font(.posButtonSymbol)
18+
Text(Image(systemName: "xmark"))
19+
.font(.posButtonSymbolSmall)
2020
}
2121
.foregroundColor(Color.posOnSurfaceVariantLowest)
2222
}
@@ -63,3 +63,9 @@ private extension PointOfSaleExitPosAlertView {
6363
)
6464
}
6565
}
66+
67+
#if DEBUG
68+
#Preview {
69+
PointOfSaleExitPosAlertView(isPresented: .constant(true))
70+
}
71+
#endif

WooCommerce/Classes/POS/Presentation/Reusable Views/POSItemImageView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ struct POSItemImageView: View {
1111
.foregroundColor(Constants.placeholderBackgroundColor)
1212
.overlay {
1313
Text(Image(systemName: "archivebox"))
14-
.font(.posButtonSymbol)
14+
.font(.posButtonSymbolLarge)
1515
.foregroundColor(Constants.placeholderIconColor)
1616
}
1717
}

WooCommerce/Classes/POS/Presentation/Reusable Views/POSModalCloseButton.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ struct POSModalCloseButton: ViewModifier {
2121
HStack {
2222
Spacer()
2323
Button(action: closeAction, label: {
24-
Image(systemName: "xmark")
25-
.font(.posButtonSymbol)
24+
Text(Image(systemName: "xmark"))
25+
.font(.posButtonSymbolSmall)
2626
})
2727
.foregroundColor(Color.posOnSurfaceVariantLowest)
2828
.accessibilityLabel(accessibilityLabel)

WooCommerce/Classes/POS/Utils/POSFontStyle.swift

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ enum POSFontStyle {
1313
case posBodySmallRegular(underline: Bool = false)
1414
case posCaptionBold
1515
case posCaptionRegular
16-
case posButtonSymbol
16+
case posButtonSymbolSmall
17+
case posButtonSymbolMedium
18+
case posButtonSymbolLarge
1719

1820
func font(maximumContentSizeCategory: UIContentSizeCategory? = nil) -> Font {
1921
switch self {
@@ -40,8 +42,12 @@ enum POSFontStyle {
4042
Font.system(size: scaledValue(FontSize.caption, maximumContentSizeCategory: maximumContentSizeCategory), weight: .bold)
4143
case .posCaptionRegular:
4244
Font.system(size: scaledValue(FontSize.caption, maximumContentSizeCategory: maximumContentSizeCategory), weight: .regular)
43-
case .posButtonSymbol:
44-
Font.system(size: scaledValue(32, maximumContentSizeCategory: maximumContentSizeCategory), weight: .medium)
45+
case .posButtonSymbolSmall:
46+
Font.system(size: scaledValue(20, maximumContentSizeCategory: maximumContentSizeCategory), weight: .semibold)
47+
case .posButtonSymbolMedium:
48+
Font.system(size: scaledValue(24, maximumContentSizeCategory: maximumContentSizeCategory), weight: .semibold)
49+
case .posButtonSymbolLarge:
50+
Font.system(size: scaledValue(30, maximumContentSizeCategory: maximumContentSizeCategory), weight: .semibold)
4551
}
4652
}
4753

@@ -104,6 +110,7 @@ extension View {
104110
}
105111

106112
// MARK: - Preview
113+
#if DEBUG
107114
#Preview {
108115
ScrollView {
109116
VStack(alignment: .leading, spacing: 20) {
@@ -134,10 +141,15 @@ extension View {
134141
.font(.posCaptionBold)
135142
Text("Caption Regular")
136143
.font(.posCaptionRegular)
137-
Text("Button Symbol")
138-
.font(.posButtonSymbol)
144+
Text("Button Symbol Small")
145+
.font(.posButtonSymbolSmall)
146+
Text("Button Symbol Medium")
147+
.font(.posButtonSymbolMedium)
148+
Text("Button Symbol Large")
149+
.font(.posButtonSymbolLarge)
139150
}
140151
}
141152
.padding()
142153
}
143154
}
155+
#endif

0 commit comments

Comments
 (0)