Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

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

Rev Autor Línea Nro. Línea
1 efrain 1
//
2
//  CommentAndRatingCommentsListItem.swift
3
//  twogetskills
4
//
5
//  Created by Efrain Yanez Recanatini on 7/28/22.
6
//
7
 
8
import SwiftUI
9
 
10
struct CommentAndRatingCommentListItem: View {
11
 
12
    var fullname : String
13
    var added_on : String
14
    var image : String
15
    var rating : Decimal
16
    var comment : String
17
    var link_delete : String
18
 
19
 
20
    var body: some View {
21
        VStack(spacing: 0 ) {
22
        Group {
23
            HStack {
24
                Group {
25
 
26
                if image.isEmpty {
27
 
28
 
29
                    Image(uiImage: UIImage(named: "logo") ?? UIImage())
30
                        .resizable()
31
                        .resizable()
32
                        .aspectRatio(contentMode: .fit)
33
 
34
 
35
 
36
                } else {
37
                    CustomAsyncImage(
38
                        url: URL(string: image)!,
39
                        placeholder: { Text(Config.LANG_COMMON_LOADING).font(.footnote).foregroundColor(.black)},
40
                        image: {
41
                            Image(uiImage: $0).resizable()
42
 
43
 
44
                        }
45
                    )
46
                }
47
                }
48
                    .frame(height: Config.COMMENT_IMAGE_SIZE)
49
 
50
                    .clipShape(Circle())
51
                    .overlay(Circle().stroke(Color.white, lineWidth: 1))
52
 
53
 
54
 
55
 
56
                VStack(spacing: 0)
57
                {
58
                    HStack {
59
                        Text(fullname)
60
                            .font(Font.custom(Config.FONT_NAME_BOLD, size: 14))
61
                            .foregroundColor(Color("color_capsule_list_item_title_foreground"))
62
 
63
                        Spacer()
64
 
65
                        if !link_delete.isEmpty {
66
 
67
                        Button(action: {}, label: {
68
                            Image(systemName: "trash")
69
                                .resizable()
70
                                .aspectRatio(contentMode: /*@START_MENU_TOKEN@*/.fill/*@END_MENU_TOKEN@*/)
71
                                .frame(width: 16, height: 16, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)
72
                        }).padding(.trailing, 10)
73
                        .foregroundColor(Color("color_capsule_list_item_title_foreground"))
74
 
75
                        }
76
                    }
77
                    HStack {
78
                        Text(comment)
79
                            .font(Font.custom(Config.FONT_NAME_REGULAR, size: 12))
80
                            .foregroundColor(Color("color_capsule_list_item_description_foreground"))
81
 
82
 
83
                        Spacer()
84
                    }.padding(.top, 3)
85
                    .padding(.bottom, 10)
86
 
87
 
88
 
89
 
90
 
91
 
92
 
93
                    HStack {
94
                        FiveStarView(rating: rating, color: Color("color_capsule_list_item_star_foreground"), backgroundColor: Color("color_capsule_list_item_star_background"))               .frame(width: /*@START_MENU_TOKEN@*/100/*@END_MENU_TOKEN@*/, height: 16, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)
95
                            .padding(.leading, 8)
96
 
97
                        Spacer()
98
 
99
                        Text(added_on)
100
                            .font(Font.custom(Config.FONT_NAME_REGULAR, size: 12))
101
                            .foregroundColor(Color("color_capsule_list_item_description_foreground"))
102
                            .padding(.trailing, 10)
103
 
104
 
105
 
106
 
107
                    }
108
 
109
 
110
                }.padding(.top, 10)
111
                .padding(.bottom, 10)
112
 
113
        }
114
 
115
 
116
        Divider()
117
        } .background(Color("color_capsule_list_item_background"))
118
        .padding(.leading, 5)
119
        .padding(.trailing, 5)
120
        }
121
    }
122
}
123
 
124
struct CommentAndRatingCommentListItem_Previews: PreviewProvider {
125
    static var previews: some View {
126
        CommentAndRatingCommentListItem(fullname: "Santiago Olivera", added_on: "2022-07-28T10:00:00", image: "", rating: 3.8, comment: "Comentario de prueba", link_delete: "LINK")
127
    }
128
}