[Framework] Feed item view in the Feed framework (#10)
This PR contains the work done to implement the `FeedItemViewController` view controller, that shows in details a selected review from the `FeedListViewController` view controller. Reviewed-on: rock-n-code/app-reviews#10 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
This commit was merged in pull request #10.
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// FeedItemCell.swift
|
||||
// ReviewsFeed
|
||||
//
|
||||
// Created by Javier Cicchelli on 19/03/2024.
|
||||
// Copyright © 2024 Röck+Cöde. All rights reserved.
|
||||
//
|
||||
|
||||
import ReviewsUIKit
|
||||
import SwiftUI
|
||||
|
||||
struct FeedItemCell: View {
|
||||
|
||||
// MARK: Constants
|
||||
private let item: Review
|
||||
|
||||
// MARK: Initialisers
|
||||
init(_ item: Review) {
|
||||
self.item = item
|
||||
}
|
||||
|
||||
// MARK: Body
|
||||
var body: some View {
|
||||
VStack(
|
||||
alignment: .leading,
|
||||
spacing: 16
|
||||
) {
|
||||
FakeLabel(
|
||||
systemIcon: .Icon.person,
|
||||
title: item.author
|
||||
)
|
||||
.foregroundColor(.secondary)
|
||||
|
||||
VStack(spacing: 8) {
|
||||
Text(item.title)
|
||||
.font(.headline)
|
||||
.lineLimit(2)
|
||||
.fullWidth()
|
||||
|
||||
Text(item.comment)
|
||||
.font(.body)
|
||||
.lineLimit(4)
|
||||
.fullWidth()
|
||||
}
|
||||
.multilineTextAlignment(.leading)
|
||||
|
||||
HStack(
|
||||
alignment: .center,
|
||||
spacing: 32
|
||||
) {
|
||||
StarRating(
|
||||
item.rating.stars,
|
||||
of: .Rating.total
|
||||
)
|
||||
|
||||
FakeLabel(
|
||||
systemIcon: .Icon.info,
|
||||
title: item.rating.appVersion
|
||||
)
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
}
|
||||
.padding(.vertical, 8)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Previews
|
||||
#Preview("Feed Item Cell") {
|
||||
FeedItemCell(.init(
|
||||
author: "Some author name here...",
|
||||
comment: "Some review comment here...",
|
||||
id: 0,
|
||||
rating: .init(
|
||||
stars: 1,
|
||||
appVersion: "v1.2.3"
|
||||
),
|
||||
title: "Some review title here..."
|
||||
))
|
||||
.padding(.horizontal)
|
||||
}
|
||||
Reference in New Issue
Block a user