Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
//// CommentAndRatingCommentsListItem.swift// twogetskills//// Created by Efrain Yanez Recanatini on 7/28/22.//import SwiftUIstruct CommentAndRatingCommentListItemView: View {var comment : CommentAndRatingCommentlet onDelete: () -> Voidvar body: some View {VStack(spacing: 0 ) {Group {HStack {Group {if comment.image.isEmpty {Image(uiImage: UIImage(named: "logo") ?? UIImage()).resizable().aspectRatio(contentMode: .fit)} else {CustomAsyncImage(url: URL(string: comment.image)!,placeholder: { Text(Config.LANG_COMMON_LOADING).font(.footnote).foregroundColor(.black)},image: {Image(uiImage: $0).resizable()})}}.frame(width: Config.COMMENT_IMAGE_SIZE_WIDTH, height: Config.COMMENT_IMAGE_SIZE_HEIGHT).clipShape(Circle()).overlay(Circle().stroke(Color.white, lineWidth: 1))VStack(spacing: 0){HStack {Text(comment.fullname).font(Font.custom(Config.FONT_NAME_BOLD, size: 14)).foregroundColor(Color("color_capsule_list_item_title_foreground"))Spacer()if !comment.link_delete.isEmpty {Button(action: onDelete, label: {Image(systemName: "trash").resizable().aspectRatio(contentMode: /*@START_MENU_TOKEN@*/.fill/*@END_MENU_TOKEN@*/).frame(width: 16, height: 16, alignment: /*@START_MENU_TOKEN@*/.center/*@END_MENU_TOKEN@*/)}).padding(.trailing, 10).foregroundColor(Color("color_capsule_list_item_title_foreground"))}}HStack {Text(comment.comment).font(Font.custom(Config.FONT_NAME_REGULAR, size: 12)).foregroundColor(Color("color_capsule_list_item_description_foreground"))Spacer()}.padding(.top, 3).padding(.bottom, 10)HStack {FiveStarView(rating: comment.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@*/).padding(.leading, 8)Spacer()Text(comment.date).font(Font.custom(Config.FONT_NAME_REGULAR, size: 12)).foregroundColor(Color("color_capsule_list_item_description_foreground")).padding(.trailing, 10)}}.padding(.top, 10).padding(.bottom, 10)}Divider()} .background(Color("color_capsule_list_item_background")).padding(.leading, 5).padding(.trailing, 5)}}}struct CommentAndRatingCommentListItemView_Previews: PreviewProvider {static var comment = CommentAndRatingComment(date: "2022-07-28T10:00:00", image: "", fullname: "Santiago Olivera", rating: 3.8, comment: "Comentario de prueba", link_delete: "LINK")static var previews: some View {CommentAndRatingCommentListItemView(comment: comment) {}}}