@@ -14,6 +14,7 @@ let CORNER_RADIUS: CGFloat = 32
|
||||
struct ProfilePicView: View {
|
||||
let picture: String?
|
||||
let size: CGFloat
|
||||
let highlighted: Bool
|
||||
|
||||
var body: some View {
|
||||
if let pic = picture.flatMap({ URL(string: $0) }) {
|
||||
@@ -23,17 +24,21 @@ struct ProfilePicView: View {
|
||||
Color.purple.opacity(0.1)
|
||||
}
|
||||
.frame(width: PFP_SIZE, height: PFP_SIZE)
|
||||
.cornerRadius(CORNER_RADIUS)
|
||||
.clipShape(Circle())
|
||||
.overlay(Circle().stroke(highlighted ? Color.red : Color.black, lineWidth: highlighted ? 4 : 0))
|
||||
.padding(2)
|
||||
} else {
|
||||
Color.purple.opacity(0.1)
|
||||
.frame(width: PFP_SIZE, height: PFP_SIZE)
|
||||
.cornerRadius(CORNER_RADIUS)
|
||||
.overlay(Circle().stroke(highlighted ? Color.red : Color.black, lineWidth: highlighted ? 4 : 0))
|
||||
.padding(2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct ProfilePicView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ProfilePicView(picture: "http://cdn.jb55.com/img/red-me.jpg", size: 64)
|
||||
ProfilePicView(picture: "http://cdn.jb55.com/img/red-me.jpg", size: 64, highlighted: false)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user