damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

PostButton.swift (1404B)


      1 //
      2 //  PostButton.swift
      3 //  damus
      4 //
      5 //  Created by William Casarin on 2022-04-11.
      6 //
      7 
      8 import Foundation
      9 import SwiftUI
     10 
     11 let BUTTON_SIZE = 57.0
     12 let LINEAR_GRADIENT = LinearGradient(gradient: Gradient(colors: [
     13     DamusColors.purple,
     14     DamusColors.blue
     15 ]), startPoint: .topTrailing, endPoint: .bottomTrailing)
     16 
     17 func PostButton(action: @escaping () -> ()) -> some View {
     18     return Button(action: action, label: {
     19         ZStack(alignment: .center) {
     20             Circle()
     21                 .fill(LINEAR_GRADIENT)
     22                 .frame(width: BUTTON_SIZE, height: BUTTON_SIZE, alignment: .center)
     23                 .rotationEffect(.degrees(20))
     24                 .padding()
     25                 .shadow(color: Color.black.opacity(0.3),
     26                         radius: 3,
     27                         x: 3,
     28                         y: 3)
     29             Image("plus")
     30                 .font(.system(.title2))
     31                 .foregroundColor(Color.white)
     32         }
     33     })
     34     .keyboardShortcut("n", modifiers: [.command, .shift])
     35 }
     36 
     37 func PostButtonContainer(is_left_handed: Bool, action: @escaping () -> Void) -> some View {
     38     return VStack {
     39         Spacer()
     40 
     41         HStack {
     42             if is_left_handed != true {
     43                 Spacer()
     44                 
     45                 PostButton(action: action)
     46             } else {
     47                 PostButton(action: action)
     48                 Spacer()
     49             }
     50         }
     51     }
     52 }