Skip to content

Commit 31362b3

Browse files
committed
added BitwardenMenuFooterView to uniformize style
1 parent 57f5a4d commit 31362b3

File tree

3 files changed

+62
-17
lines changed

3 files changed

+62
-17
lines changed

BitwardenShared/UI/Platform/Application/Views/BitwardenMenuField.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,11 +346,11 @@ struct BitwardenMenuField<
346346
Group {
347347
Divider()
348348
if let footerContent = footerContent as? Text {
349-
footerContent
350-
.styleGuide(.footnote, includeLinePadding: false, includeLineSpacing: false)
351-
.foregroundColor(SharedAsset.Colors.textSecondary.swiftUIColor)
352-
.multilineTextAlignment(.leading)
353-
.padding(.vertical, 12)
349+
BitwardenMenuFooterTextField(
350+
footerContent,
351+
topPadding: 12,
352+
bottomPadding: 12
353+
)
354354
} else {
355355
footerContent
356356
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import BitwardenResources
2+
import SwiftUI
3+
4+
// MARK: - BitwardenMenuFooterTextField
5+
6+
/// A text view for the footer on BitwardenMenu
7+
///
8+
struct BitwardenMenuFooterTextField: View {
9+
10+
/// The content of the text view.
11+
private let content: Text
12+
13+
/// The bottom padding of the text view.
14+
private let topPadding: CGFloat
15+
16+
/// The bottom padding of the text view.
17+
private let bottomPadding: CGFloat
18+
19+
init(_ content: Text, topPadding: CGFloat = 0, bottomPadding: CGFloat = 12) {
20+
self.content = content
21+
self.topPadding = topPadding
22+
self.bottomPadding = bottomPadding
23+
}
24+
25+
init(_ title: LocalizedStringKey, topPadding: CGFloat = 0, bottomPadding: CGFloat = 12) {
26+
content = Text(title)
27+
self.topPadding = topPadding
28+
self.bottomPadding = bottomPadding
29+
}
30+
31+
init(_ title: String, topPadding: CGFloat = 0, bottomPadding: CGFloat = 12) {
32+
content = Text(title)
33+
self.topPadding = topPadding
34+
self.bottomPadding = bottomPadding
35+
}
36+
37+
// MARK: View
38+
var body: some View {
39+
content
40+
.styleGuide(.footnote, includeLinePadding: false, includeLineSpacing: false)
41+
.foregroundColor(SharedAsset.Colors.textSecondary.swiftUIColor)
42+
.multilineTextAlignment(.leading)
43+
.padding(.top, topPadding)
44+
.padding(.bottom, bottomPadding)
45+
}
46+
}

BitwardenShared/UI/Platform/Settings/Settings/AutoFill/AutoFillView.swift

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ struct AutoFillView: View {
7272
accessibilityIdentifier: "CopyTotpAutomaticallySwitch"
7373
)
7474
.contentBlock()
75-
75+
7676
BitwardenMenuField(
7777
title: Localizations.defaultUriMatchDetection,
7878
accessibilityIdentifier: "DefaultUriMatchDetectionChooser",
@@ -83,19 +83,18 @@ struct AutoFillView: View {
8383
)
8484
) {
8585
VStack(alignment: .leading, spacing: 0) {
86-
Text(Localizations.uriMatchDetectionControlsHowBitwardenIdentifiesAutofillSuggestions)
87-
.styleGuide(.footnote, includeLinePadding: false, includeLineSpacing: false)
88-
.foregroundColor(SharedAsset.Colors.textSecondary.swiftUIColor)
89-
.multilineTextAlignment(.leading)
90-
.padding(.top, 12)
91-
.padding(.bottom, store.state.warningMessage == nil ? 12 : 4)
86+
BitwardenMenuFooterTextField(
87+
Localizations.uriMatchDetectionControlsHowBitwardenIdentifiesAutofillSuggestions,
88+
topPadding: 12,
89+
bottomPadding: store.state.warningMessage == nil ? 12 : 4
90+
)
9291

9392
store.state.warningMessage.map { warningMessage in
94-
Text(LocalizedStringKey(warningMessage))
95-
.styleGuide(.footnote, includeLinePadding: false, includeLineSpacing: false)
96-
.foregroundColor(SharedAsset.Colors.textSecondary.swiftUIColor)
97-
.multilineTextAlignment(.leading)
98-
.padding(.bottom, 12)
93+
BitwardenMenuFooterTextField(
94+
LocalizedStringKey(warningMessage),
95+
topPadding: 0,
96+
bottomPadding: 12
97+
)
9998
}
10099
}
101100
}

0 commit comments

Comments
 (0)