mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-24 16:51:19 +01:00
fixes button state on account help view
This commit is contained in:
parent
f7574dc633
commit
015ee0a8e0
@ -14,33 +14,24 @@ struct AddAccountHelpView: View {
|
||||
let accountTypes: [AccountType] = AddAccountSections.allOrdered.sectionContent
|
||||
var delegate: AccountsPreferencesAddAccountDelegate?
|
||||
var helpText: String
|
||||
@State private var hoveringId: String? = nil
|
||||
@State private var iCloudUnavailableError: Bool = false
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
HStack {
|
||||
ForEach(accountTypes, id: \.self) { account in
|
||||
account.image()
|
||||
.resizable()
|
||||
.frame(width: 20, height: 20, alignment: .center)
|
||||
.onTapGesture {
|
||||
Button(action: {
|
||||
if account == .cloudKit && AccountManager.shared.accounts.contains(where: { $0.type == .cloudKit }) {
|
||||
iCloudUnavailableError = true
|
||||
} else {
|
||||
delegate?.presentSheetForAccount(account)
|
||||
}
|
||||
hoveringId = nil
|
||||
}
|
||||
.onHover(perform: { hovering in
|
||||
if hovering {
|
||||
hoveringId = account.localizedAccountName()
|
||||
} else {
|
||||
hoveringId = nil
|
||||
}
|
||||
}, label: {
|
||||
account.image()
|
||||
.resizable()
|
||||
.frame(width: 20, height: 20, alignment: .center)
|
||||
})
|
||||
.scaleEffect(hoveringId == account.localizedAccountName() ? 1.2 : 1)
|
||||
.shadow(radius: hoveringId == account.localizedAccountName() ? 0.8 : 0)
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user