aboutsummaryrefslogtreecommitdiff
path: root/Hotline/macOS/Chat/ServerMessageView.swift
blob: 6c3c60edd3411bb5895e5172152c0d418d746f99 (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
import SwiftUI

struct ServerMessageView: View {
  let message: String
  
  var body: some View {
    HStack(alignment: .center, spacing: 8) {
      Image("Server Message")
        .symbolRenderingMode(.multicolor)
        .resizable()
        .scaledToFit()
        .frame(width: 20, height: 20)
      Text(message)
        .fontWeight(.semibold)
        .lineSpacing(4)
        .multilineTextAlignment(.leading)
        .textSelection(.enabled)
      Spacer()
    }
    .padding()
    .frame(maxWidth: .infinity)
#if os(iOS)
    .background(Color("Agreement Background"))
#elseif os(macOS)
    .background(VisualEffectView(material: .titlebar, blendingMode: .withinWindow))
#endif
    .clipShape(RoundedRectangle(cornerRadius: 16, style: .continuous))
  }
}

#Preview {
  ServerMessageView(message: "This server has something important to say.")
}