comparison LazyBear/Views/Company/Helpers/NewsRow.swift @ 443:ffbb1dbab531

InsiderRosterHelper implemented
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Mon, 21 Jun 2021 20:17:46 +0200
parents 6eae10397501
children 8621ba6fd457
comparison
equal deleted inserted replaced
442:6eae10397501 443:ffbb1dbab531
4 // 4 //
5 // Created by Dennis Concepción Martín on 21/6/21. 5 // Created by Dennis Concepción Martín on 21/6/21.
6 // 6 //
7 7
8 import SwiftUI 8 import SwiftUI
9 import SDWebImageSwiftUI
10 9
11 struct NewsRow: View { 10 struct NewsRow: View {
12 var new: LatestNewsModel 11 var new: LatestNewsModel
13 @State private var showWebArticle = false 12 @State private var showWebArticle = false
14 13
15 var body: some View { 14 var body: some View {
16 HStack { 15 HStack {
17 RoundedRectangle(cornerRadius: 10)
18 .frame(width: 65, height: 65, alignment: .center)
19 .overlay(
20 WebImage(url: URL(string: new.image))
21 .resizable()
22 .placeholder {
23 Rectangle()
24 .foregroundColor(.gray)
25 }
26 .indicator(.activity)
27 .scaledToFill()
28 )
29 .clipShape(RoundedRectangle(cornerRadius: 10))
30
31 VStack(alignment: .leading) { 16 VStack(alignment: .leading) {
32 Text(new.headline) 17 Text("\(convertEpoch(new.datetime, true)) ago")
18 .font(.caption2)
19 .opacity(0.5)
20
21 Text(new.headline.capitalized)
33 .font(.callout) 22 .font(.callout)
34 .fontWeight(.semibold) 23 .fontWeight(.semibold)
35 .fixedSize(horizontal: false, vertical: true) /// I need to add this to make lineLimit works correctly 24 .fixedSize(horizontal: false, vertical: true) /// I need to add this to make lineLimit works correctly
36 .lineLimit(3) 25 .lineLimit(3)
37 } 26 }
38 .padding(.horizontal, 5) 27 // .padding(.horizontal, 5)
28
29 Spacer()
39 30
40 Button(action: { showWebArticle = true }) { 31 Button(action: { showWebArticle = true }) {
41 Capsule() 32 Capsule()
42 .foregroundColor(Color(.secondarySystemBackground)) 33 .foregroundColor(Color(.secondarySystemBackground))
43 .frame(width: 80, height: 35, alignment: .center) 34 .frame(width: 80, height: 35, alignment: .center)