Sesame-iOS/Sesame-Watch Watch App/HistoryListRow.swift
2023-12-12 17:33:42 +01:00

43 lines
927 B
Swift

import SwiftUI
import SFSafeSymbols
private let df: DateFormatter = {
let df = DateFormatter()
df.dateStyle = .short
df.timeStyle = .short
df.doesRelativeDateFormatting = true
return df
}()
struct HistoryListRow: View {
let item: HistoryItem
private var entryTime: String {
df.string(from: item.startDate)
}
var body: some View {
VStack(alignment: .leading) {
HStack {
Image(systemSymbol: item.response.symbol)
Text(item.response.description)
.font(.headline)
.foregroundColor(.primary)
Spacer()
}
Text(entryTime)
.font(.footnote)
.foregroundColor(.accentColor)
}
}
}
struct HistoryListRow_Previews: PreviewProvider {
static var previews: some View {
HistoryListRow(item: .mock)
}
}