Created
July 3, 2024 07:30
-
-
Save velotiotech/869985cc8aa8f6b0b8f11cb344be61e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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