Impressia/Vernissage/Widgets/UsernameRow.swift

32 lines
933 B
Swift
Raw Normal View History

2023-01-03 14:09:22 +01:00
//
// https://mczachurski.dev
// Copyright © 2023 Marcin Czachurski and the repository contributors.
// Licensed under the MIT License.
//
import SwiftUI
2023-01-05 21:08:19 +01:00
import NukeUI
2023-01-03 14:09:22 +01:00
struct UsernameRow: View {
2023-01-18 18:41:42 +01:00
@State public var accountId: String
2023-01-05 21:08:19 +01:00
@State public var accountAvatar: URL?
@State public var accountDisplayName: String?
@State public var accountUsername: String
2023-02-27 16:04:42 +01:00
@State public var size: UserAvatar.Size?
2023-01-03 14:09:22 +01:00
var body: some View {
HStack (alignment: .center) {
2023-02-27 16:04:42 +01:00
UserAvatar(accountAvatar: accountAvatar, size: size ?? .list)
2023-01-03 14:09:22 +01:00
VStack (alignment: .leading) {
2023-01-05 21:08:19 +01:00
Text(accountDisplayName ?? accountUsername)
2023-01-06 13:05:21 +01:00
.foregroundColor(.mainTextColor)
2023-01-05 21:08:19 +01:00
Text("@\(accountUsername)")
2023-01-06 13:05:21 +01:00
.foregroundColor(.lightGrayColor)
2023-01-03 14:09:22 +01:00
.font(.footnote)
}
.padding(.leading, 8)
}
}
}