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
|
// MARK: - Quick Start Section
|
||||||
|
|
||||||
|
@State private var quickStartButtonHeight: CGFloat?
|
||||||
|
|
||||||
private var quickStartSection: some View {
|
private var quickStartSection: some View {
|
||||||
VStack(alignment: .leading, spacing: Design.Spacing.small) {
|
VStack(alignment: .leading, spacing: Design.Spacing.small) {
|
||||||
Text(String(localized: "Quick Start"))
|
Text(String(localized: "Quick Start"))
|
||||||
@ -107,9 +109,20 @@ struct TodayEmptyStateView: View {
|
|||||||
spacing: Design.Spacing.small
|
spacing: Design.Spacing.small
|
||||||
) {
|
) {
|
||||||
ForEach(OnboardingGoal.allCases) { goal in
|
ForEach(OnboardingGoal.allCases) { goal in
|
||||||
QuickStartButton(goal: goal) {
|
QuickStartButton(goal: goal, uniformHeight: quickStartButtonHeight) {
|
||||||
startQuickRitual(for: goal)
|
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)
|
.padding(.horizontal, Design.Spacing.small)
|
||||||
@ -127,6 +140,7 @@ struct TodayEmptyStateView: View {
|
|||||||
/// A compact button for quick-starting a ritual from a goal category.
|
/// A compact button for quick-starting a ritual from a goal category.
|
||||||
private struct QuickStartButton: View {
|
private struct QuickStartButton: View {
|
||||||
let goal: OnboardingGoal
|
let goal: OnboardingGoal
|
||||||
|
let uniformHeight: CGFloat?
|
||||||
let action: () -> Void
|
let action: () -> Void
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
@ -137,11 +151,14 @@ private struct QuickStartButton: View {
|
|||||||
Text(goal.displayName)
|
Text(goal.displayName)
|
||||||
.typography(.subheading)
|
.typography(.subheading)
|
||||||
.foregroundStyle(AppTextColors.primary)
|
.foregroundStyle(AppTextColors.primary)
|
||||||
|
.lineLimit(2)
|
||||||
|
.fixedSize(horizontal: false, vertical: true)
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
.padding(.horizontal, Design.Spacing.medium)
|
.padding(.horizontal, Design.Spacing.medium)
|
||||||
.padding(.vertical, Design.Spacing.small)
|
.padding(.vertical, Design.Spacing.small)
|
||||||
|
.frame(height: uniformHeight)
|
||||||
.background(AppSurface.tertiary)
|
.background(AppSurface.tertiary)
|
||||||
.clipShape(.rect(cornerRadius: Design.CornerRadius.medium))
|
.clipShape(.rect(cornerRadius: Design.CornerRadius.medium))
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user