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