template sharing

This commit is contained in:
Trey t
2022-02-26 16:16:40 -06:00
parent 4b7c64cbc6
commit 7bcd9a3d13
4 changed files with 150 additions and 92 deletions

View File

@@ -64,16 +64,6 @@ struct AllMoodsTotalTemplate: View, SharingTemplate {
private var circularViews: some View {
VStack {
HStack {
ForEach(Mood.allValues, id: \.self) { mood in
mood.icon
.resizable()
.aspectRatio(contentMode: .fit)
.foregroundColor(moodTint.color(forMood: mood))
}
}
VStack {
HStack {
ForEach(entries.prefix(2), id: \.mood) { model in
@@ -134,28 +124,46 @@ struct AllMoodsTotalTemplate: View, SharingTemplate {
var shareView: some View {
VStack {
Text(String(format: String(localized: "share_view_all_moods_total_template_title"), totalEntryCount))
Text(String(format: String(localized: "share_view_all_moods_total_template_title"), totalEntryCount))
.font(.title)
.foregroundColor(theme.currentTheme.labelColor)
.frame(maxWidth: .infinity, alignment: .center)
.padding()
HStack {
ForEach(Mood.allValues, id: \.self) { mood in
Circle()
.frame(minWidth: 10, idealWidth: 70, maxWidth: 100, minHeight: 10, idealHeight: 70, maxHeight: 100)
.aspectRatio(contentMode: .fit)
.foregroundColor(moodTint.color(forMood: mood))
.overlay(
mood.icon
.resizable()
.aspectRatio(contentMode: .fit)
.foregroundColor(.white)
.padding(9)
)
}
}
.padding()
circularViews
.padding()
Spacer()
}.padding()
}
.background(Color(UIColor.secondarySystemBackground))
.cornerRadius(10)
.padding()
}
var mainView: some View {
VStack {
shareView
.background(Color(UIColor.secondarySystemBackground))
.cornerRadius(10)
HStack(alignment: .center) {
Button(action: {
let _image = self.image
print(_image)
self.shareImage.showFuckingSheet = true
self.shareImage.fuckingWrappedShrable = _image
}, label: {
@@ -197,19 +205,22 @@ struct AllMoodsTotalTemplate: View, SharingTemplate {
var body: some View {
if isPreview {
preview
.padding([.leading, .trailing], -20)
shareView
.scaleEffect(2)
} else {
mainView
.padding([.leading, .trailing, .top])
}
}
}
struct AllMoodsSharingTemplate_Previews: PreviewProvider {
static var previews: some View {
AllMoodsTotalTemplate(isPreview: true, startDate: Date(), endDate: Date(), fakeData: true)
AllMoodsTotalTemplate(isPreview: false, startDate: Date(), endDate: Date(), fakeData: true)
Group {
AllMoodsTotalTemplate(isPreview: true, startDate: Date(), endDate: Date(), fakeData: true)
AllMoodsTotalTemplate(isPreview: false, startDate: Date(), endDate: Date(), fakeData: true)
AllMoodsTotalTemplate(isPreview: false, startDate: Date(), endDate: Date(), fakeData: true).shareView
}
}
}