Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

Rev 11 | 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 SwiftUI

struct CommentAndRatingCommentListItem: View {
    
    var fullname : String
    var added_on : String
    var image : String
    var rating : Decimal
    var comment : String
    var link_delete : String
    
    
    var body: some View {
        VStack(spacing: 0 ) {
        Group {
            HStack {
                Group {
                
                if image.isEmpty {
                    
                    
                    Image(uiImage: UIImage(named: "logo") ?? UIImage())
                        .resizable()
                        .resizable()
                        .aspectRatio(contentMode: .fit)
                           
                       
                    
                } else {
                    CustomAsyncImage(
                        url: URL(string: image)!,
                        placeholder: { Text(Config.LANG_COMMON_LOADING).font(.footnote).foregroundColor(.black)},
                        image: {
                            Image(uiImage: $0).resizable()
                          
                                   
                        }
                    )
                }
                }
                    .frame(height: Config.COMMENT_IMAGE_SIZE)
           
                    .clipShape(Circle())
                    .overlay(Circle().stroke(Color.white, lineWidth: 1))
                    
                
       
                
                VStack(spacing: 0)
                {
                    HStack {
                        Text(fullname)
                            .font(Font.custom(Config.FONT_NAME_BOLD, size: 14))
                            .foregroundColor(Color("color_capsule_list_item_title_foreground"))
                     
                        Spacer()
                        
                        if !link_delete.isEmpty {
                        
                        Button(action: {}, 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)
                            .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: 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(added_on)
                            .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 CommentAndRatingCommentListItem_Previews: PreviewProvider {
    static var previews: some View {
        CommentAndRatingCommentListItem(fullname: "Santiago Olivera", added_on: "2022-07-28T10:00:00", image: "", rating: 3.8, comment: "Comentario de prueba", link_delete: "LINK")
    }
}