Skip to content

Commit e613fd0

Browse files
committed
extact content
1 parent 3988873 commit e613fd0

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

WooCommerce/Classes/ViewRelated/ReusableViews/SwiftUI Components/MultilineEditableTextRow/MultilineEditableTextRow.swift

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,33 @@ struct MultilineEditableTextRow: View {
1515
NavigationLink {
1616
MultilineEditableTextDetailView(text: $value, title: detailTitle)
1717
} label: {
18-
HStack(alignment: .center, spacing: Layout.spacing) {
19-
if value.isEmpty {
20-
Text(placeholder)
21-
.rowTextStyle()
22-
.foregroundStyle(Color(.textSubtle))
23-
} else {
24-
Text(value)
25-
.multilineTextAlignment(.leading)
26-
.foregroundStyle(Color.primary)
27-
}
28-
29-
Spacer()
30-
31-
DisclosureIndicator()
32-
}
33-
.padding(.vertical, Layout.padding)
18+
content
19+
}
20+
}
21+
22+
@ViewBuilder
23+
private var content: some View {
24+
HStack(alignment: .center, spacing: Layout.spacing) {
25+
label
26+
27+
Spacer()
28+
29+
DisclosureIndicator()
30+
}
31+
.padding(.vertical, Layout.padding)
32+
}
33+
34+
@ViewBuilder
35+
private var label: some View {
36+
if value.isEmpty {
37+
Text(placeholder)
38+
.rowTextStyle()
39+
.foregroundStyle(Color(.textSubtle))
40+
41+
} else {
42+
Text(value)
43+
.multilineTextAlignment(.leading)
44+
.foregroundStyle(Color.primary)
3445
}
3546
}
3647
}

0 commit comments

Comments
 (0)