Displaying an icon for AllBanksListItem; extracted AccountFallbackIcon
This commit is contained in:
parent
4597c3fce5
commit
847f1b2508
|
@ -8,4 +8,7 @@ class Styles {
|
||||||
static let NegativeAmountColor = Color.red
|
static let NegativeAmountColor = Color.red
|
||||||
|
|
||||||
|
|
||||||
|
static let AccountFallbackIcon = "accounts"
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,7 @@ struct AllBanksListItem: View {
|
||||||
Section {
|
Section {
|
||||||
ZStack {
|
ZStack {
|
||||||
HStack {
|
HStack {
|
||||||
Text("All accounts")
|
IconedTitleView(accountTitle: "All accounts".localize(), iconUrl: nil, defaultIconName: Styles.AccountFallbackIcon, titleFont: .headline)
|
||||||
.font(.headline)
|
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
|
|
|
@ -17,11 +17,11 @@ struct IconedTitleView: View {
|
||||||
|
|
||||||
|
|
||||||
init(_ bank: Customer, titleFont: Font? = nil) {
|
init(_ bank: Customer, titleFont: Font? = nil) {
|
||||||
self.init(accountTitle: bank.displayName, iconUrl: bank.iconUrl, defaultIconName: "accounts", titleFont: titleFont)
|
self.init(accountTitle: bank.displayName, iconUrl: bank.iconUrl, defaultIconName: Styles.AccountFallbackIcon, titleFont: titleFont)
|
||||||
}
|
}
|
||||||
|
|
||||||
init(_ account: BankAccount, titleFont: Font? = nil) {
|
init(_ account: BankAccount, titleFont: Font? = nil) {
|
||||||
self.init(accountTitle: account.displayName, iconUrl: account.customer.iconUrl, defaultIconName: "accounts", titleFont: titleFont)
|
self.init(accountTitle: account.displayName, iconUrl: account.customer.iconUrl, defaultIconName: Styles.AccountFallbackIcon, titleFont: titleFont)
|
||||||
}
|
}
|
||||||
|
|
||||||
init(accountTitle: String, iconUrl: String?, defaultIconName: String, titleFont: Font? = nil) {
|
init(accountTitle: String, iconUrl: String?, defaultIconName: String, titleFont: Font? = nil) {
|
||||||
|
@ -60,7 +60,7 @@ struct IconedTitleView: View {
|
||||||
|
|
||||||
private func getTitleView() -> Text {
|
private func getTitleView() -> Text {
|
||||||
if let titleFont = titleFont {
|
if let titleFont = titleFont {
|
||||||
return Text(self.title)
|
return Text(title)
|
||||||
.font(titleFont)
|
.font(titleFont)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -74,7 +74,7 @@ struct IconedTitleView: View {
|
||||||
struct IconedAccountTitle_Previews: PreviewProvider {
|
struct IconedAccountTitle_Previews: PreviewProvider {
|
||||||
|
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
IconedTitleView(accountTitle: "Abzockbank", iconUrl: nil, defaultIconName: "accounts")
|
IconedTitleView(accountTitle: "Abzockbank", iconUrl: nil, defaultIconName: Styles.AccountFallbackIcon)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue