Impressia/Vernissage/Widgets/InteractionRow.swift

76 lines
2.1 KiB
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
struct InteractionRow: View {
2023-01-04 17:56:01 +01:00
@ObservedObject public var statusData: StatusData
2023-01-03 14:09:22 +01:00
var body: some View {
HStack (alignment: .top) {
2023-01-04 17:56:01 +01:00
Button {
2023-01-05 11:55:20 +01:00
// TODO: Reply.
2023-01-04 17:56:01 +01:00
} label: {
HStack(alignment: .center) {
Image(systemName: "message")
Text("\(statusData.repliesCount)")
.font(.caption)
2023-01-03 14:09:22 +01:00
}
}
2023-01-04 17:56:01 +01:00
Spacer()
Button {
2023-01-05 11:55:20 +01:00
// TODO: Reboost.
2023-01-04 17:56:01 +01:00
} label: {
HStack(alignment: .center) {
2023-01-04 20:56:26 +01:00
Image(systemName: statusData.reblogged ? "paperplane.fill" : "paperplane")
2023-01-04 17:56:01 +01:00
Text("\(statusData.reblogsCount)")
.font(.caption)
2023-01-03 14:09:22 +01:00
}
}
Spacer()
2023-01-04 17:56:01 +01:00
Button {
2023-01-05 11:55:20 +01:00
// TODO: Favorite.
2023-01-04 17:56:01 +01:00
} label: {
HStack(alignment: .center) {
Image(systemName: statusData.favourited ? "hand.thumbsup.fill" : "hand.thumbsup")
Text("\(statusData.favouritesCount)")
.font(.caption)
}
}
Spacer()
Button {
2023-01-05 11:55:20 +01:00
// TODO: Bookmark.
2023-01-04 17:56:01 +01:00
} label: {
2023-01-03 14:09:22 +01:00
Image(systemName: statusData.bookmarked ? "bookmark.fill" : "bookmark")
}
2023-01-04 17:56:01 +01:00
Spacer()
Button {
2023-01-05 11:55:20 +01:00
// TODO: Share.
2023-01-04 17:56:01 +01:00
} label: {
Image(systemName: "square.and.arrow.up")
}
2023-01-03 14:09:22 +01:00
}
2023-01-04 17:56:01 +01:00
.font(.title3)
.fontWeight(.semibold)
.foregroundColor(Color.accentColor)
2023-01-03 14:09:22 +01:00
}
}
struct InteractionRow_Previews: PreviewProvider {
static var previews: some View {
2023-01-04 20:56:26 +01:00
InteractionRow(statusData: PreviewData.getStatus())
.previewLayout(.fixed(width: 300, height: 70))
2023-01-03 14:09:22 +01:00
}
}