Skip to content

Commit 2ddae25

Browse files
committed
Move store creation plan features to a separate SwiftUI view.
1 parent 52c1024 commit 2ddae25

File tree

3 files changed

+33
-12
lines changed

3 files changed

+33
-12
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import SwiftUI
2+
3+
/// Displays a vertical list of features included in the WPCOM plan during the store creation flow.
4+
struct StoreCreationPlanFeaturesView: View {
5+
/// Features to show in a vertical list.
6+
let features: [StoreCreationPlanViewModel.Feature]
7+
8+
var body: some View {
9+
VStack(alignment: .leading, spacing: 16) {
10+
ForEach(features, id: \.title) { feature in
11+
HStack(spacing: 12) {
12+
Image(uiImage: feature.icon)
13+
.renderingMode(.template)
14+
.foregroundColor(Color(.wooCommercePurple(.shade90)))
15+
Text(feature.title)
16+
.foregroundColor(Color(.label))
17+
.bodyStyle()
18+
}
19+
}
20+
}
21+
}
22+
}
23+
24+
struct StoreCreationPlanFeaturesView_Previews: PreviewProvider {
25+
static var previews: some View {
26+
StoreCreationPlanFeaturesView(features: [.init(icon: .megaphoneIcon, title: "Get updates!")])
27+
}
28+
}

WooCommerce/Classes/Authentication/Store Creation/Plan/StoreCreationPlanView.swift

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,7 @@ struct StoreCreationPlanView: View {
113113
.frame(height: 32)
114114

115115
// Plan features.
116-
VStack(alignment: .leading, spacing: 16) {
117-
ForEach(viewModel.features, id: \.title) { feature in
118-
HStack(spacing: 12) {
119-
Image(uiImage: feature.icon)
120-
.renderingMode(.template)
121-
.foregroundColor(Color(.wooCommercePurple(.shade90)))
122-
Text(feature.title)
123-
.foregroundColor(Color(.label))
124-
.bodyStyle()
125-
}
126-
}
127-
}
116+
StoreCreationPlanFeaturesView(features: viewModel.features)
128117
}
129118
.padding(Layout.defaultPadding)
130119
}

WooCommerce/WooCommerce.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@
278278
0282DD96233C960C006A5FDB /* SearchResultCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0282DD95233C960C006A5FDB /* SearchResultCell.swift */; };
279279
0282DD98233CA093006A5FDB /* OrderSearchUICommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0282DD97233CA093006A5FDB /* OrderSearchUICommand.swift */; };
280280
0285BF7022FBD91C003A2525 /* TopPerformersSectionHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0285BF6F22FBD91C003A2525 /* TopPerformersSectionHeaderView.swift */; };
281+
02863F6A29246E18006A06AA /* StoreCreationPlanFeaturesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02863F6929246E18006A06AA /* StoreCreationPlanFeaturesView.swift */; };
281282
0286837727B25930000E5785 /* HubMenuViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0286837627B25930000E5785 /* HubMenuViewModelTests.swift */; };
282283
0286B27A23C7051F003D784B /* ProductImagesCollectionViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0286B27623C7051F003D784B /* ProductImagesCollectionViewController.xib */; };
283284
0286B27B23C7051F003D784B /* ProductImagesCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0286B27723C7051F003D784B /* ProductImagesCollectionViewController.swift */; };
@@ -2242,6 +2243,7 @@
22422243
0282DD95233C960C006A5FDB /* SearchResultCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchResultCell.swift; sourceTree = "<group>"; };
22432244
0282DD97233CA093006A5FDB /* OrderSearchUICommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderSearchUICommand.swift; sourceTree = "<group>"; };
22442245
0285BF6F22FBD91C003A2525 /* TopPerformersSectionHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopPerformersSectionHeaderView.swift; sourceTree = "<group>"; };
2246+
02863F6929246E18006A06AA /* StoreCreationPlanFeaturesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoreCreationPlanFeaturesView.swift; sourceTree = "<group>"; };
22452247
0286837627B25930000E5785 /* HubMenuViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HubMenuViewModelTests.swift; sourceTree = "<group>"; };
22462248
0286B27623C7051F003D784B /* ProductImagesCollectionViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ProductImagesCollectionViewController.xib; sourceTree = "<group>"; };
22472249
0286B27723C7051F003D784B /* ProductImagesCollectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProductImagesCollectionViewController.swift; sourceTree = "<group>"; };
@@ -4949,6 +4951,7 @@
49494951
children = (
49504952
02EEA9272923338100D05F47 /* StoreCreationPlanView.swift */,
49514953
020AF66229235860007760E5 /* StoreCreationPlanViewModel.swift */,
4954+
02863F6929246E18006A06AA /* StoreCreationPlanFeaturesView.swift */,
49524955
);
49534956
path = Plan;
49544957
sourceTree = "<group>";
@@ -10497,6 +10500,7 @@
1049710500
DE0A2EAA281BA083007A8015 /* ProductCategoryList.swift in Sources */,
1049810501
02AC30CF2888EC8100146A25 /* WooAnalyticsEvent+LoginOnboarding.swift in Sources */,
1049910502
2667BFEB2535FF09008099D4 /* RefundShippingCalculationUseCase.swift in Sources */,
10503+
02863F6A29246E18006A06AA /* StoreCreationPlanFeaturesView.swift in Sources */,
1050010504
B6C838DE28793B3A003AB786 /* OrderCustomFieldsViewModel.swift in Sources */,
1050110505
E1E125AA26EB42530068A9B0 /* CardPresentModalUpdateProgress.swift in Sources */,
1050210506
E1C5E78226C2A971008D4C47 /* InPersonPaymentsPluginNotSetup.swift in Sources */,

0 commit comments

Comments
 (0)