Refine InfoView

This commit is contained in:
Alfonso Grillo
2022-10-26 18:35:29 +02:00
parent a9f8ad9c3a
commit b90b9b539e
4 changed files with 29 additions and 28 deletions
@@ -27,45 +27,46 @@ struct InfoView: View {
private let description: String
private let action: Action
init(title: String, descripion: String, action: Action) {
init(title: String, description: String, action: Action) {
self.title = title
self.description = descripion
self.description = description
self.action = action
}
var body: some View {
GeometryReader { proxy in
VStack(alignment: .leading, spacing: 24) {
VStack(alignment: .leading, spacing: 16) {
Text(title)
.font(theme.fonts.calloutSB)
.foregroundColor(theme.colors.primaryContent)
Text(description)
.font(theme.fonts.footnote)
.foregroundColor(theme.colors.primaryContent)
}
VStack(alignment: .leading, spacing: 24) {
VStack(alignment: .leading, spacing: 16) {
Text(title)
.font(theme.fonts.calloutSB)
.foregroundColor(theme.colors.primaryContent)
.accessibilityIdentifier(title)
Button(action: action.action) {
Text(action.text)
.font(theme.fonts.bodySB)
.foregroundColor(theme.colors.background)
.frame(height: 48)
.frame(maxWidth: .infinity)
}
.background(theme.colors.accent)
.cornerRadius(8)
Text(description)
.font(theme.fonts.footnote)
.foregroundColor(theme.colors.primaryContent)
.accessibilityIdentifier(description)
}
.padding(24)
.frame(maxWidth: .infinity, maxHeight: .infinity)
Button(action: action.action) {
Text(action.text)
.font(theme.fonts.bodySB)
.foregroundColor(theme.colors.background)
.frame(height: 48)
.frame(maxWidth: .infinity)
.accessibilityIdentifier(action.text)
}
.background(theme.colors.accent)
.cornerRadius(8)
}
.padding(24)
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}
struct InfoView_Previews: PreviewProvider {
static var previews: some View {
InfoView(title: "Verified sessions",
descripion: "Verified sessions have logged in with your credentials and then been verified, either using your secure passphrase or by cross-verifying.\n\nThis means they hold encryption keys for your previous messages, and confirm to other users you are communicating with that these sessions are really you.",
description: "Verified sessions have logged in with your credentials and then been verified, either using your secure passphrase or by cross-verifying.\n\nThis means they hold encryption keys for your previous messages, and confirm to other users you are communicating with that these sessions are really you.",
action: .init(text: "GOT IT", action: {}))
}
}