Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created July 3, 2024 07:30
Show Gist options
  • Save velotiotech/869985cc8aa8f6b0b8f11cb344be61e1 to your computer and use it in GitHub Desktop.
Save velotiotech/869985cc8aa8f6b0b8f11cb344be61e1 to your computer and use it in GitHub Desktop.
struct MonthlyHolidayWidgetEntryView: View {
var entry: DayEntry
var config: MonthConfig
// Custom initializer to configure the view based on the entry's date
init(entry: DayEntry) {
self.entry = entry
self.config = MonthConfig.determineConfig(from: entry.date)
}
var body: some View {
ZStack {
// Background shape with gradient color based on the month configuration
ContainerRelativeShape()
.fill(config.backgroundColor.gradient)
VStack {
Spacer()
// Display the date associated with the month
HStack(spacing: 4) {
Text(config.dateText)
.foregroundColor(config.dayTextColor)
.font(.system(size: 25, weight: .heavy))
}
Spacer()
// Display the name of the month
Text(config.month)
.font(.system(size: 38, weight: .heavy))
.foregroundColor(config.dayTextColor)
Spacer()
}
.padding()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment