wip
This commit is contained in:
56
Shared2/Views/EntryListView.swift
Normal file
56
Shared2/Views/EntryListView.swift
Normal file
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// EntryListView.swift
|
||||
// Feels (iOS)
|
||||
//
|
||||
// Created by Trey Tartt on 3/6/22.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct EntryListView: View {
|
||||
@AppStorage(UserDefaultsStore.Keys.moodImages.rawValue, store: GroupUserDefaults.groupDefaults) private var imagePack: MoodImages = .FontAwesome
|
||||
@AppStorage(UserDefaultsStore.Keys.moodTint.rawValue, store: GroupUserDefaults.groupDefaults) private var moodTint: MoodTints = .Default
|
||||
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = DefaultTextColor.textColor
|
||||
|
||||
public let entry: MoodEntry
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
imagePack.icon(forMood: entry.mood)
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.frame(width: 40, height: 40, alignment: .center)
|
||||
.foregroundColor(moodTint.color(forMood: entry.mood))
|
||||
.padding(.leading, 15)
|
||||
|
||||
VStack {
|
||||
HStack {
|
||||
Text(Random.weekdayName(fromDate:entry.forDate!))
|
||||
.font(.title3)
|
||||
.foregroundColor(textColor)
|
||||
Text(" - ")
|
||||
.padding([.leading, .trailing], -10)
|
||||
.foregroundColor(textColor)
|
||||
Text(Random.dayFormat(fromDate:entry.forDate!))
|
||||
.font(.title3)
|
||||
.foregroundColor(textColor)
|
||||
Spacer()
|
||||
}
|
||||
.multilineTextAlignment(.leading)
|
||||
|
||||
Text(entry.moodValue == Mood.missing.rawValue ? String(localized: "mood_value_missing_tap_to_add") : "\(entry.moodString)")
|
||||
.font(.body)
|
||||
.foregroundColor(Color(UIColor.systemGray))
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct EntryListView_Previews: PreviewProvider {
|
||||
static let fakeData = PersistenceController.shared.randomEntries(count: 1).first!
|
||||
|
||||
static var previews: some View {
|
||||
EntryListView(entry: EntryListView_Previews.fakeData)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user