|
|
|
@ -7,29 +7,59 @@ |
|
|
|
|
|
|
|
|
|
|
|
import SwiftUI |
|
|
|
import SwiftUI |
|
|
|
|
|
|
|
|
|
|
|
struct DateBoxView: View { |
|
|
|
struct DateVerticalView: View { |
|
|
|
let date: Date |
|
|
|
let date: Date |
|
|
|
var displayStyle: DisplayStyle = .wide |
|
|
|
var body: some View { |
|
|
|
|
|
|
|
VStack(alignment: .trailing, spacing: 0.0) { |
|
|
|
|
|
|
|
DateView(date: self.date) |
|
|
|
|
|
|
|
MonthYearView(date: self.date) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct DateView: View { |
|
|
|
|
|
|
|
let date: Date |
|
|
|
var body: some View { |
|
|
|
var body: some View { |
|
|
|
VStack(alignment: .center, spacing: 0.0) { |
|
|
|
VStack(alignment: .center, spacing: 0.0) { |
|
|
|
Text(date.formatted(.dateTime.weekday(.abbreviated)).uppercased()) |
|
|
|
Text(self.date.formatted(.dateTime.weekday(.abbreviated)).uppercased()) |
|
|
|
HStack(alignment: .bottom) { |
|
|
|
Text(self.date.formatted(.dateTime.day(.twoDigits))) |
|
|
|
Text(date.formatted(.dateTime.day(.twoDigits))) |
|
|
|
.font(.title3).fontWeight(.semibold) |
|
|
|
.font(displayStyle == .wide ? .title : .title3) |
|
|
|
|
|
|
|
.monospacedDigit() |
|
|
|
.monospacedDigit() |
|
|
|
.padding(-2) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if displayStyle == .wide { |
|
|
|
|
|
|
|
Text(date.formatted(.dateTime.month(.abbreviated)).uppercased()) |
|
|
|
|
|
|
|
Text(date.formatted(.dateTime.year())) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.font(.footnote) |
|
|
|
|
|
|
|
.fontWeight(.semibold) |
|
|
|
struct MonthYearView: View { |
|
|
|
|
|
|
|
let date: Date |
|
|
|
|
|
|
|
var body: some View { |
|
|
|
|
|
|
|
Text(date.formatted(.dateTime.month(.abbreviated)).uppercased()) |
|
|
|
|
|
|
|
Text(date.formatted(.dateTime.year())) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//struct DateBoxView: View { |
|
|
|
|
|
|
|
// let date: Date |
|
|
|
|
|
|
|
// var displayStyle: DisplayStyle = .wide |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// var body: some View { |
|
|
|
|
|
|
|
// VStack(alignment: .center, spacing: 0.0) { |
|
|
|
|
|
|
|
// Text(date.formatted(.dateTime.weekday(.abbreviated)).uppercased()) |
|
|
|
|
|
|
|
// HStack(alignment: .bottom) { |
|
|
|
|
|
|
|
// Text(date.formatted(.dateTime.day(.twoDigits))) |
|
|
|
|
|
|
|
// .font(displayStyle == .wide ? .title : .title3) |
|
|
|
|
|
|
|
// .monospacedDigit() |
|
|
|
|
|
|
|
// .padding(-2) |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// if displayStyle == .wide { |
|
|
|
|
|
|
|
// Text(date.formatted(.dateTime.month(.abbreviated)).uppercased()) |
|
|
|
|
|
|
|
// Text(date.formatted(.dateTime.year())) |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// .font(.footnote) |
|
|
|
|
|
|
|
//// .fontWeight(.semibold) |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
//} |
|
|
|
|
|
|
|
|
|
|
|
#Preview { |
|
|
|
#Preview { |
|
|
|
DateBoxView(date: Date()) |
|
|
|
DateVerticalView(date: Date()) |
|
|
|
} |
|
|
|
} |
|
|
|
|