Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

Rev 25 | | Comparar con el anterior | 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
61 efrain 13
 
23 efrain 14
 
15
 
22 efrain 16
 
17
    var body: some View {
18
        VStack(spacing: 0 ) {
19
        Group {
20
            HStack {
21
 
22
                VStack(spacing: 0)
23
                {
24
                    HStack {
25
                        Text(notification.title)
24 efrain 26
                            .font(Font.custom(Config.FONT_NAME_BOLD, size: 16))
22 efrain 27
                            .foregroundColor(Color("color_capsule_list_item_title_foreground"))
28
 
29
                        Spacer()
30
 
31
 
25 efrain 32
                        if !notification.command.isEmpty && notification.viewed == 0 {
33
 
61 efrain 34
 
25 efrain 35
                                Image(systemName: "arrowtriangle.right.fill")
36
                                    .resizable()
37
                                    .aspectRatio(contentMode: /*@START_MENU_TOKEN@*/.fill/*@END_MENU_TOKEN@*/)
38
                                    .frame(width: 16, height: 16, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)
61 efrain 39
                            .padding(.trailing, 10)
25 efrain 40
                            .foregroundColor(Color("color_capsule_list_item_title_foreground"))
41
 
42
                        } else {
43
 
44
 
61 efrain 45
 
22 efrain 46
                                Image(systemName: "trash")
47
                                    .resizable()
48
                                    .aspectRatio(contentMode: /*@START_MENU_TOKEN@*/.fill/*@END_MENU_TOKEN@*/)
49
                                    .frame(width: 16, height: 16, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)
61 efrain 50
                            .padding(.trailing, 10)
22 efrain 51
                            .foregroundColor(Color("color_capsule_list_item_title_foreground"))
25 efrain 52
                        }
22 efrain 53
 
54
                    }
55
                    HStack {
23 efrain 56
                        Text(notification.body)
22 efrain 57
                            .font(Font.custom(Config.FONT_NAME_REGULAR, size: 12))
58
                            .foregroundColor(Color("color_capsule_list_item_description_foreground"))
59
 
60
 
61
                        Spacer()
62
                    }.padding(.top, 3)
63
                    .padding(.bottom, 10)
64
 
65
 
23 efrain 66
                    HStack {
67
 
68
 
69
                        Spacer()
70
 
71
                        Text(notification.timeOn)
72
                            .font(Font.custom(Config.FONT_NAME_REGULAR, size: 12))
73
                            .foregroundColor(Color("color_capsule_list_item_description_foreground"))
74
                            .padding(.trailing, 10)
75
 
76
 
22 efrain 77
 
23 efrain 78
 
24 efrain 79
                    }.padding(.top, 5)
23 efrain 80
                .padding(.bottom, 10)
22 efrain 81
 
82
 
83
 
23 efrain 84
 
85
            }.padding(.top, 10)
86
            .padding(.bottom, 10)
87
 
22 efrain 88
        }
89
 
90
 
91
        Divider()
92
        } .background(Color("color_capsule_list_item_background"))
93
        .padding(.leading, 5)
94
        .padding(.trailing, 5)
95
        }
96
    }
97
}
98
 
99
struct NotificationListItemView_Previews: PreviewProvider {
100
 
23 efrain 101
    static var  notification  = UserNotificationModel( userUuid: "U123", title: "Titulo Notification #1", body: "Description Notification #1", viewed: 0, url: "https://www.google.co.ve", dateOn: "2022-08-12", timeOn: "10:00:00")
22 efrain 102
 
103
    static var previews: some View {
61 efrain 104
        NotificationListItemView(notification: notification)
22 efrain 105
    }
106
}
107