Add vibrant styling to Account Views
This commit is contained in:
parent
7bda205af8
commit
ac93dfbd91
|
@ -11,18 +11,32 @@ import Account
|
|||
|
||||
struct SettingsAddAccountView : View {
|
||||
@Environment(\.presentationMode) var presentation
|
||||
@State private var accountAddAction: Int? = nil
|
||||
|
||||
var body: some View {
|
||||
Form {
|
||||
NavigationLink(destination: SettingsLocalAccountView(name: "")) {
|
||||
|
||||
NavigationLink(destination: SettingsLocalAccountView(name: ""), tag: 1, selection: $accountAddAction) {
|
||||
SettingsAccountLabelView(accountImage: "accountLocal", accountLabel: Account.defaultLocalAccountName)
|
||||
}
|
||||
NavigationLink(destination: SettingsFeedbinAccountView(viewModel: SettingsFeedbinAccountView.ViewModel())) {
|
||||
.modifier(VibrantSelectAction(action: {
|
||||
self.accountAddAction = 1
|
||||
}))
|
||||
|
||||
NavigationLink(destination: SettingsFeedbinAccountView(viewModel: SettingsFeedbinAccountView.ViewModel()), tag: 2, selection: $accountAddAction) {
|
||||
SettingsAccountLabelView(accountImage: "accountFeedbin", accountLabel: "Feedbin")
|
||||
}
|
||||
NavigationLink(destination: SettingsReaderAPIAccountView(viewModel: SettingsReaderAPIAccountView.ViewModel(accountType: .freshRSS))) {
|
||||
.modifier(VibrantSelectAction(action: {
|
||||
self.accountAddAction = 2
|
||||
}))
|
||||
|
||||
NavigationLink(destination: SettingsReaderAPIAccountView(viewModel: SettingsReaderAPIAccountView.ViewModel(accountType: .freshRSS)), tag: 3, selection: $accountAddAction) {
|
||||
SettingsAccountLabelView(accountImage: "accountFreshRSS", accountLabel: "Fresh RSS")
|
||||
}
|
||||
.modifier(VibrantSelectAction(action: {
|
||||
self.accountAddAction = 3
|
||||
}))
|
||||
|
||||
}
|
||||
.navigationBarTitle(Text("Add Account"), displayMode: .inline)
|
||||
}
|
||||
|
|
|
@ -29,15 +29,11 @@ struct SettingsDetailAccountView : View {
|
|||
}
|
||||
if viewModel.isCreditialsAvailable {
|
||||
Section {
|
||||
HStack {
|
||||
Spacer()
|
||||
Button(action: {
|
||||
self.accountType = self.viewModel.account.type
|
||||
}) {
|
||||
Text("Credentials")
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
.sheet(item: $accountType) { type in
|
||||
if type == .feedbin {
|
||||
|
@ -50,15 +46,11 @@ struct SettingsDetailAccountView : View {
|
|||
}
|
||||
if viewModel.isDeletable {
|
||||
Section {
|
||||
HStack {
|
||||
Spacer()
|
||||
Button(action: {
|
||||
self.isDeleteAlertPresented.toggle()
|
||||
}) {
|
||||
Text("Delete Account").foregroundColor(.red)
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
.alert(isPresented: $isDeleteAlertPresented) {
|
||||
Alert(title: Text("Are you sure you want to delete \"\(viewModel.nameForDisplay)\"?"),
|
||||
primaryButton: Alert.Button.default(Text("Delete"), action: {
|
||||
|
@ -70,6 +62,7 @@ struct SettingsDetailAccountView : View {
|
|||
}
|
||||
}
|
||||
}
|
||||
.buttonStyle(VibrantButtonStyle(alignment: .center))
|
||||
.navigationBarTitle(Text(verbatim: viewModel.nameForDisplay), displayMode: .inline)
|
||||
|
||||
}
|
||||
|
|
|
@ -38,8 +38,6 @@ struct SettingsFeedbinAccountView : View {
|
|||
Spacer()
|
||||
}
|
||||
) {
|
||||
HStack {
|
||||
Spacer()
|
||||
Button(action: { self.addAccount() }) {
|
||||
if viewModel.isUpdate {
|
||||
Text("Update Account")
|
||||
|
@ -47,9 +45,8 @@ struct SettingsFeedbinAccountView : View {
|
|||
Text("Add Account")
|
||||
}
|
||||
}
|
||||
.buttonStyle(VibrantButtonStyle(alignment: .center))
|
||||
.disabled(!viewModel.isValid)
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
// .disabled(busy) // Maybe someday we can do this, but right now it crashes on the iPad
|
||||
|
|
|
@ -29,13 +29,10 @@ struct SettingsLocalAccountView : View {
|
|||
}
|
||||
}
|
||||
Section {
|
||||
HStack {
|
||||
Spacer()
|
||||
Button(action: { self.addAccount() }) {
|
||||
Text("Add Account")
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
.buttonStyle(VibrantButtonStyle(alignment: .center))
|
||||
}
|
||||
}
|
||||
.navigationBarTitle(Text(""), displayMode: .inline)
|
||||
|
|
|
@ -41,8 +41,6 @@ struct SettingsReaderAPIAccountView : View {
|
|||
Spacer()
|
||||
}
|
||||
) {
|
||||
HStack {
|
||||
Spacer()
|
||||
Button(action: { self.addAccount() }) {
|
||||
if viewModel.isUpdate {
|
||||
Text("Update Account")
|
||||
|
@ -50,9 +48,8 @@ struct SettingsReaderAPIAccountView : View {
|
|||
Text("Add Account")
|
||||
}
|
||||
}
|
||||
.buttonStyle(VibrantButtonStyle(alignment: .center))
|
||||
.disabled(!viewModel.isValid)
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
// .disabled(busy)
|
||||
|
|
|
@ -36,7 +36,7 @@ struct SettingsView : View {
|
|||
buildDatabaseSection()
|
||||
buildAboutSection()
|
||||
}
|
||||
.buttonStyle(VibrantButtonStyle())
|
||||
.buttonStyle(VibrantButtonStyle(alignment: .leading))
|
||||
.navigationBarTitle(Text("Settings"), displayMode: .inline)
|
||||
.navigationBarItems(leading: Button(action: { self.viewController?.dismiss(animated: true) }) { Text("Done") } )
|
||||
}
|
||||
|
|
|
@ -10,10 +10,12 @@ import SwiftUI
|
|||
|
||||
struct VibrantButtonStyle: ButtonStyle {
|
||||
|
||||
let alignment: Alignment
|
||||
|
||||
func makeBody(configuration: Configuration) -> some View {
|
||||
GeometryReader { geometry in
|
||||
configuration.label
|
||||
.frame(width: geometry.size.width, height: geometry.size.height, alignment: .leading)
|
||||
.frame(width: geometry.size.width, height: geometry.size.height, alignment: self.alignment)
|
||||
}
|
||||
.foregroundColor(configuration.isPressed ? Color(AppAssets.tableViewCellHighlightedTextColor) : .primary)
|
||||
.listRowBackground(configuration.isPressed ? Color(AppAssets.tableViewCellSelectionColor) : Color(.secondarySystemGroupedBackground))
|
||||
|
|
Loading…
Reference in New Issue