Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
ee347bb402
commit
7d0581fdd8
@ -92,6 +92,8 @@ struct TodayEmptyStateView: View {
|
||||
|
||||
// MARK: - Quick Start Section
|
||||
|
||||
@State private var quickStartButtonHeight: CGFloat?
|
||||
|
||||
private var quickStartSection: some View {
|
||||
VStack(alignment: .leading, spacing: Design.Spacing.small) {
|
||||
Text(String(localized: "Quick Start"))
|
||||
@ -107,9 +109,20 @@ struct TodayEmptyStateView: View {
|
||||
spacing: Design.Spacing.small
|
||||
) {
|
||||
ForEach(OnboardingGoal.allCases) { goal in
|
||||
QuickStartButton(goal: goal) {
|
||||
QuickStartButton(goal: goal, uniformHeight: quickStartButtonHeight) {
|
||||
startQuickRitual(for: goal)
|
||||
}
|
||||
.onGeometryChange(for: CGFloat.self) { proxy in
|
||||
proxy.size.height
|
||||
} action: { height in
|
||||
if let current = quickStartButtonHeight {
|
||||
if height > current {
|
||||
quickStartButtonHeight = height
|
||||
}
|
||||
} else {
|
||||
quickStartButtonHeight = height
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, Design.Spacing.small)
|
||||
@ -127,6 +140,7 @@ struct TodayEmptyStateView: View {
|
||||
/// A compact button for quick-starting a ritual from a goal category.
|
||||
private struct QuickStartButton: View {
|
||||
let goal: OnboardingGoal
|
||||
let uniformHeight: CGFloat?
|
||||
let action: () -> Void
|
||||
|
||||
var body: some View {
|
||||
@ -137,11 +151,14 @@ private struct QuickStartButton: View {
|
||||
Text(goal.displayName)
|
||||
.typography(.subheading)
|
||||
.foregroundStyle(AppTextColors.primary)
|
||||
.lineLimit(2)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding(.horizontal, Design.Spacing.medium)
|
||||
.padding(.vertical, Design.Spacing.small)
|
||||
.frame(height: uniformHeight)
|
||||
.background(AppSurface.tertiary)
|
||||
.clipShape(.rect(cornerRadius: Design.CornerRadius.medium))
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user