damus

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

IconLabel.swift (1271B)


      1 //
      2 //  IconLabel.swift
      3 //  damus
      4 //
      5 //  Created by William Casarin on 2023-04-05.
      6 //
      7 
      8 import SwiftUI
      9 import UIKit
     10 
     11 struct IconLabel: View {
     12     let text: String
     13     let img_name: String
     14     let img_color: Color
     15     
     16     init(_ text: String, img_name: String, color: Color) {
     17         self.text = text
     18         self.img_name = img_name
     19         self.img_color = color
     20     }
     21     
     22     var body: some View {
     23         HStack(spacing: 0) {
     24             Image(img_name)
     25                 .foregroundColor(img_color)
     26                 .frame(width: 20)
     27                 .padding([.trailing], 20)
     28             Text(text)
     29         }
     30     }}
     31 
     32 struct IconLabel_Previews: PreviewProvider {
     33     static var previews: some View {
     34         Form {
     35             Section {
     36                 IconLabel(NSLocalizedString("Keys", comment: "Settings section for managing keys"), img_name: "key.fill", color: .orange)
     37             
     38                 IconLabel(NSLocalizedString("Local Notifications", comment: "Section header for damus local notifications user configuration"), img_name: "bell.fill", color: .blue)
     39             
     40                 IconLabel(NSLocalizedString("Appearance", comment: "Section header for text and appearance settings"), img_name: "textformat", color: .red)
     41             }
     42         }
     43     }
     44 }