leganto-apple/Leganto/FeedViewCell.swift
Louis Hollingworth 9345b91573
Added Esperanto translations
Added beginnings of feed parsing,
    may need to switch parser.

Signed-off-by: Louis Hollingworth <louis@hollingworth.ch>
2023-05-28 19:43:37 +01:00

49 lines
1.4 KiB
Swift

//
// FeedViewCell.swift
// Leganto
//
// Created by Louis Hollingworth on 2023-05-23.
//
import SwiftUI
struct FeedViewCell: View {
let title: String
let author: String
let date: Date
let content: String
var body: some View {
VStack(alignment: .leading) {
Text(title)
.font(.title)
HStack {
Text(author)
Spacer()
Text(date, formatter: dateFormatter)
}
.font(.footnote)
Text(content)
.font(.body)
}
.multilineTextAlignment(.leading)
}
}
private let dateFormatter: DateFormatter = {
let formatter = DateFormatter()
formatter.dateStyle = .short
formatter.timeStyle = .short
return formatter
}()
struct FeedViewCell_Previews: PreviewProvider {
static var previews: some View {
FeedViewCell(
title: "Test", author: "Test Author", date: Date(),
content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
)
}
}