[#1194] Security Warning: make the text clickable as well to improve usability
- New ZashiToggle created to handle tap on the label as well - All 3 system Toggles replaced with new one
This commit is contained in:
parent
c64e1ef21b
commit
cd0fba7665
|
@ -37,12 +37,11 @@ public struct DeleteWalletView: View {
|
|||
}
|
||||
|
||||
HStack {
|
||||
Toggle(isOn: $store.isAcknowledged, label: {
|
||||
Text(L10n.DeleteWallet.iUnderstand)
|
||||
.font(.custom(FontFamily.Inter.medium.name, size: 14))
|
||||
})
|
||||
.toggleStyle(CheckboxToggleStyle())
|
||||
|
||||
ZashiToggle(
|
||||
isOn: $store.isAcknowledged,
|
||||
label: L10n.DeleteWallet.iUnderstand
|
||||
)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.top, 30)
|
||||
|
|
|
@ -40,11 +40,10 @@ public struct PrivateDataConsentView: View {
|
|||
.lineSpacing(2)
|
||||
|
||||
HStack {
|
||||
Toggle(isOn: viewStore.$isAcknowledged, label: {
|
||||
Text(L10n.PrivateDataConsent.confirmation)
|
||||
.font(.custom(FontFamily.Inter.medium.name, size: 14))
|
||||
})
|
||||
.toggleStyle(CheckboxToggleStyle())
|
||||
ZashiToggle(
|
||||
isOn: viewStore.$isAcknowledged,
|
||||
label: L10n.PrivateDataConsent.confirmation
|
||||
)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
|
|
@ -46,11 +46,10 @@ public struct SecurityWarningView: View {
|
|||
}
|
||||
|
||||
HStack {
|
||||
Toggle(isOn: $store.isAcknowledged, label: {
|
||||
Text(L10n.SecurityWarning.acknowledge)
|
||||
.font(.custom(FontFamily.Inter.medium.name, size: 14))
|
||||
})
|
||||
.toggleStyle(CheckboxToggleStyle())
|
||||
ZashiToggle(
|
||||
isOn: $store.isAcknowledged,
|
||||
label: L10n.SecurityWarning.acknowledge
|
||||
)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
//
|
||||
// ZashiToggle.swift
|
||||
//
|
||||
//
|
||||
// Created by Lukáš Korba on 04-16-2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Generated
|
||||
|
||||
public struct ZashiToggle: View {
|
||||
@Binding var isOn: Bool
|
||||
let label: String
|
||||
|
||||
public init(isOn: Binding<Bool>, label: String) {
|
||||
self._isOn = isOn
|
||||
self.label = label
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
Button {
|
||||
isOn.toggle()
|
||||
} label: {
|
||||
Toggle(isOn: $isOn, label: {
|
||||
Text(label)
|
||||
.font(.custom(FontFamily.Inter.medium.name, size: 14))
|
||||
})
|
||||
.toggleStyle(CheckboxToggleStyle())
|
||||
}
|
||||
.foregroundColor(Asset.Colors.primary.color)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
@State var isOn: Bool = false
|
||||
|
||||
return ZashiToggle(isOn: $isOn, label: "I acknowledge")
|
||||
}
|
Loading…
Reference in New Issue