Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

Rev 23 | Ir a la última revisión | | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
22 efrain 1
//
2
//  NotificationListItemView.swift
3
//  twogetskills
4
//
5
//  Created by admin on 8/14/22.
6
//
7
 
8
import SwiftUI
9
 
10
struct NotificationListItemView: View {
11
 
12
    var notification :  UserNotificationModel
13
    let onDelete: () -> Void
14
 
15
    /*
16
    init(notification : UserNotificationModel)
17
    {
18
        let formatterService = DateFormatter()
19
        formatterService.dateFormat = Constants.FORMAT_DATETIME_SERVICE
20
        if let date = formatterService.date(from: notification.addedOn) {
21
 
22
        let dateFormatterUser = DateFormatter()
23
        dateFormatterUser.dateFormat = Constants.FORMAT_DATE_TIME_24
24
        self.addedOnToUser =  dateFormatterUser.string(from: date)
25
 
26
 
27
    }*/
28
 
29
    var body: some View {
30
        VStack(spacing: 0 ) {
31
        Group {
32
            HStack {
33
 
34
                VStack(spacing: 0)
35
                {
36
                    HStack {
37
                        Text(notification.title)
38
                            .font(Font.custom(Config.FONT_NAME_BOLD, size: 14))
39
                            .foregroundColor(Color("color_capsule_list_item_title_foreground"))
40
 
41
                        Spacer()
42
 
43
 
44
                            Button(action:  onDelete, label: {
45
                                Image(systemName: "trash")
46
                                    .resizable()
47
                                    .aspectRatio(contentMode: /*@START_MENU_TOKEN@*/.fill/*@END_MENU_TOKEN@*/)
48
                                    .frame(width: 16, height: 16, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)
49
                            }).padding(.trailing, 10)
50
                            .foregroundColor(Color("color_capsule_list_item_title_foreground"))
51
 
52
                    }
53
                    HStack {
54
                        Text(notification.description)
55
                            .font(Font.custom(Config.FONT_NAME_REGULAR, size: 12))
56
                            .foregroundColor(Color("color_capsule_list_item_description_foreground"))
57
 
58
 
59
                        Spacer()
60
                    }.padding(.top, 3)
61
                    .padding(.bottom, 10)
62
 
63
 
64
 
65
 
66
 
67
                }.padding(.top, 10)
68
                .padding(.bottom, 10)
69
 
70
        }
71
 
72
 
73
        Divider()
74
        } .background(Color("color_capsule_list_item_background"))
75
        .padding(.leading, 5)
76
        .padding(.trailing, 5)
77
        }
78
    }
79
}
80
 
81
struct NotificationListItemView_Previews: PreviewProvider {
82
 
83
    static var  notification  = UserNotificationModel( userUuid: "U123", title: "Titulo Notification #1", description: "Description Notification #1", viewed: 0, url: "https://www.google.co.ve", addedOn: "2022-08-12T10:00:00")
84
 
85
    static var previews: some View {
86
        NotificationListItemView(notification: notification) {
87
 
88
        }
89
    }
90
}
91