aboutsummaryrefslogtreecommitdiff
path: root/Hotline/macOS/ServerAgreementView.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Hotline/macOS/ServerAgreementView.swift')
-rw-r--r--Hotline/macOS/ServerAgreementView.swift60
1 files changed, 30 insertions, 30 deletions
diff --git a/Hotline/macOS/ServerAgreementView.swift b/Hotline/macOS/ServerAgreementView.swift
index a1f96d9..77e9e15 100644
--- a/Hotline/macOS/ServerAgreementView.swift
+++ b/Hotline/macOS/ServerAgreementView.swift
@@ -1,13 +1,13 @@
import SwiftUI
-fileprivate let MAX_AGREEMENT_HEIGHT: CGFloat = 280
+private let MAX_AGREEMENT_HEIGHT: CGFloat = 280
struct ServerAgreementView: View {
let text: String
-
+
@State private var expandable: Bool = false
@State private var expanded: Bool = false
-
+
var body: some View {
ScrollView(.vertical) {
HStack(alignment: .top) {
@@ -24,8 +24,7 @@ struct ServerAgreementView: View {
Color.clear.onAppear {
if geometry.size.height > MAX_AGREEMENT_HEIGHT {
expandable = true
- }
- else {
+ } else {
expandable = false
}
}
@@ -37,41 +36,42 @@ struct ServerAgreementView: View {
.scrollIndicators(.never)
.frame(maxWidth: .infinity, maxHeight: (expandable && expanded) ? nil : MAX_AGREEMENT_HEIGHT)
.scrollBounceBehavior(.basedOnSize)
-#if os(iOS)
- .background(Color("Agreement Background"))
-#elseif os(macOS)
- .background(VisualEffectView(material: .titlebar, blendingMode: .withinWindow))
-#endif
+ #if os(iOS)
+ .background(Color("Agreement Background"))
+ #elseif os(macOS)
+ .background(VisualEffectView(material: .titlebar, blendingMode: .withinWindow))
+ #endif
.overlay(
ZStack(alignment: .bottomTrailing) {
Group {
if !expandable || expanded {
EmptyView()
- }
- else {
- Button(action: {
- withAnimation(.easeOut(duration: 0.15)) {
- expanded = true
+ } else {
+ Button(
+ action: {
+ withAnimation(.easeOut(duration: 0.15)) {
+ expanded = true
+ }
+ },
+ label: {
+ Color.black
+ .opacity(0.00001)
+ .frame(width: 32, height: 32)
+ .overlay(
+ Image(systemName: "arrow.up.left.and.arrow.down.right")
+ .resizable()
+ .scaledToFit()
+ .fontWeight(.semibold)
+ .frame(width: 12, height: 12)
+ .foregroundColor(.primary.opacity(0.8)), alignment: .center)
}
- }, label: {
- Color.black
- .opacity(0.00001)
- .frame(width: 32, height: 32)
- .overlay(
- Image(systemName: "arrow.up.left.and.arrow.down.right")
- .resizable()
- .scaledToFit()
- .fontWeight(.semibold)
- .frame(width: 12, height: 12)
- .foregroundColor(.primary.opacity(0.8))
- , alignment: .center)
- })
+ )
.buttonStyle(.plain)
.help("Expand Server Agreement")
}
}
- }
- , alignment: .bottomTrailing)
+ }, alignment: .bottomTrailing
+ )
.clipShape(RoundedRectangle(cornerRadius: 8))
}
}