-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKarlieKlossView1.swift
110 lines (91 loc) · 3.98 KB
/
KarlieKlossView1.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
//
// KarlieKlossView1.swift
// accompliSHARE1
//
// Created by Gnapika Birlangi on 8/2/23.
//
import SwiftUI
struct KarlieKlossView1: View {
@State private var buttonText = "Follow"
let user: User
var body: some View {
VStack {
if let fullname = user.fullname {
Text(fullname)
.font(.title2)
.fontWeight(.bold)
.padding(.top, 10)
}
Divider()
ScrollView {
VStack {
HStack {
Image(user.profileImageUrl ?? "")
.resizable()
.scaledToFill()
.frame(width: 100.0, height: 100.0)
.clipShape(Circle())
VStack (alignment: .leading, spacing: 5.0) {
if let fullname = user.fullname {
Text(fullname)
.font(.headline)
.fontWeight(.semibold)
}
if let bio = user.bio {
Text(bio)
.font(.footnote)
}
if let minutesStudied = user.minutesStudied {
Text("Mintues studied: \(minutesStudied)")
.font(.footnote)
}
}
.frame(alignment: .leading)
.padding(.horizontal)
Spacer()
}
.padding(.all)
HStack {
VStack(alignment: .leading, spacing: 4){
if let followerCount = user.followers.count {
if user.fullname != "Karlie Kloss"{
UserStatView(value: followerCount, digit: "", title: "Followers")
} else {
UserStatView(value: followerCount, digit: "M", title: "Followers")
}
}
if let followingCount = user.following.count {
UserStatView(value: followingCount, digit: "", title: "Following")
}
}
Button {
if(self.buttonText == "Follow"){
self.buttonText = "Following"
} else {
self.buttonText = "Follow"
}
} label: {
Text(self.buttonText)
.font(.subheadline)
.fontWeight(.semibold)
.frame(width: 125, height: 32)
.background(Color(.systemBlue))
.foregroundColor(.white)
.cornerRadius(6)
.overlay(
RoundedRectangle(cornerRadius: 6)
.stroke(.clear, lineWidth: 1))
}
.padding(.trailing, 30)
}
}
}
.background(Color(red: 240/255, green: 248/255, blue: 255/255))
}
}
}
struct KarlieKlossView1_Previews: PreviewProvider {
static var previews: some View {
KarlieKlossView1(user: User.MOCK_USERS[6])
}
}