krz/rune
an ios client for njalla
clone: git clone https://gitbay.org/krz/rune.git
v1.2.0: Rune/Views/Shared/FeedbackViews.swift · raw
1import SwiftUI
2
3struct InlineErrorView: View {
4 let message: String
5 let retryTitle: String
6 let retryAction: () -> Void
7
8 var body: some View {
9 VStack(alignment: .leading, spacing: 8) {
10 Text(message)
11 .font(.subheadline)
12 .foregroundStyle(.red)
13
14 Button(retryTitle, action: retryAction)
15 .font(.subheadline.weight(.semibold))
16 }
17 .frame(maxWidth: .infinity, alignment: .leading)
18 .padding()
19 .background(Color.red.opacity(0.08), in: RoundedRectangle(cornerRadius: 12, style: .continuous))
20 }
21}
22
23struct FeedbackBanner: View {
24 let message: String
25 let tint: Color
26
27 var body: some View {
28 Text(message)
29 .font(.subheadline.weight(.semibold))
30 .foregroundStyle(tint)
31 .frame(maxWidth: .infinity, alignment: .leading)
32 .padding(.horizontal, 14)
33 .padding(.vertical, 10)
34 .background(tint.opacity(0.12), in: RoundedRectangle(cornerRadius: 12, style: .continuous))
35 .padding(.horizontal)
36 .padding(.top, 8)
37 }
38}