aboutsummaryrefslogtreecommitdiff
path: root/Hotline/Views/AgreementView.swift
blob: 39730ce4531a83eb072cef2f5f213e82dda5ae59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import SwiftUI

struct AgreementView: View {
  @Environment(HotlineState.self) private var appState
  
  let text: String
  
  var body: some View {
//    @Bindable var config = appState
    
    VStack(alignment: .leading) {
      ScrollView {
        VStack(alignment: .leading) {
          Text(text)
            .fontDesign(.monospaced)
            .padding()
            .dynamicTypeSize(.small)
            .textSelection(.enabled)
        }
      }
      Button("OK") {
        print("DONE")
        appState.dismissAgreement()
      }
      .bold()
      .padding(EdgeInsets(top: 16, leading: 24, bottom: 16, trailing: 24))
      .frame(maxWidth: .infinity)
    }
    .presentationDetents([.fraction(0.6)])
    .presentationDragIndicator(.visible)
  }
}

#Preview {
  AgreementView(text: """
Welcome!

Take it on real one.
""")
}