damus

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

PurpleViewPrimitives.swift (3699B)


      1 //
      2 //  PurpleViewPrimitives.swift
      3 //  damus
      4 //
      5 //  Created by Daniel D’Aquino on 2024-02-09.
      6 //
      7 
      8 import Foundation
      9 import SwiftUI
     10 
     11 struct PurpleViewPrimitives {
     12     struct IconOnBoxView: View {
     13         var name: String
     14 
     15         var body: some View {
     16             ZStack {
     17                 RoundedRectangle(cornerRadius: 20.0)
     18                     .background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: 20.0))
     19                     .frame(width: 80, height: 80)
     20                     .overlay(
     21                         RoundedRectangle(cornerRadius: 20)
     22                             .stroke(LinearGradient(
     23                                 colors: [DamusColors.pink, .white.opacity(0), .white.opacity(0.5), .white.opacity(0)],
     24                                 startPoint: .topLeading,
     25                                 endPoint: .bottomTrailing), lineWidth: 1)
     26                     )
     27 
     28                             Image(name)
     29                     .resizable()
     30                     .frame(width: 50, height: 50)
     31                     .foregroundColor(.white)
     32             }
     33         }
     34     }
     35 
     36     struct IconView: View {
     37         var name: String
     38 
     39         var body: some View {
     40             Image(name)
     41                 .resizable()
     42                 .frame(width: 50, height: 50)
     43                 .foregroundColor(.white)
     44         }
     45     }
     46 
     47     struct TitleView: View {
     48         var text: String
     49 
     50         var body: some View {
     51             Text(text)
     52                 .font(.title3)
     53                 .bold()
     54                 .foregroundColor(.white)
     55                 .padding(.bottom, 3)
     56         }
     57     }
     58 
     59     struct SubtitleView: View {
     60         var text: String
     61 
     62         var body: some View {
     63             Text(text)
     64                 .foregroundColor(.white.opacity(0.65))
     65         }
     66     }
     67 
     68     struct ProductLoadErrorView: View {
     69         var body: some View {
     70             Text("Subscription Error", comment: "Ah dang there was an error loading subscription information from the AppStore. Please try again later :(")
     71                 .foregroundColor(.white)
     72         }
     73     }
     74 
     75     struct SaveTextView: View {
     76         var body: some View {
     77             Text("Save 14%", comment: "Percentage of purchase price the user will save")
     78                 .font(.callout)
     79                 .italic()
     80                 .foregroundColor(DamusColors.green)
     81         }
     82     }
     83 }
     84 
     85 struct IconOnBoxView_Previews: PreviewProvider {
     86     static var previews: some View {
     87         PurpleViewPrimitives.IconOnBoxView(name: "badge")
     88             .previewLayout(.sizeThatFits)
     89             .background(Color.black)
     90     }
     91 }
     92 
     93 struct IconView_Previews: PreviewProvider {
     94     static var previews: some View {
     95         PurpleViewPrimitives.IconView(name: "badge")
     96             .previewLayout(.sizeThatFits)
     97             .background(Color.black)
     98     }
     99 }
    100 
    101 struct TitleView_Previews: PreviewProvider {
    102     static var previews: some View {
    103         PurpleViewPrimitives.TitleView(text: "Title Text")
    104             .previewLayout(.sizeThatFits)
    105             .background(Color.black)
    106     }
    107 }
    108 
    109 struct SubtitleView_Previews: PreviewProvider {
    110     static var previews: some View {
    111         PurpleViewPrimitives.SubtitleView(text: "Subtitle Text")
    112             .previewLayout(.sizeThatFits)
    113             .background(Color.black)
    114     }
    115 }
    116 
    117 struct ProductLoadErrorView_Previews: PreviewProvider {
    118     static var previews: some View {
    119         PurpleViewPrimitives.ProductLoadErrorView()
    120             .previewLayout(.sizeThatFits)
    121             .background(Color.black)
    122     }
    123 }
    124 
    125 struct SaveTextView_Previews: PreviewProvider {
    126     static var previews: some View {
    127         PurpleViewPrimitives.SaveTextView()
    128             .previewLayout(.sizeThatFits)
    129             .background(Color.black)
    130     }
    131 }