79 lines
2.5 KiB
Swift
79 lines
2.5 KiB
Swift
//
|
|
// OnboardingBottomControls.swift
|
|
// TheNoiseClock
|
|
//
|
|
// Bottom navigation controls for onboarding flow.
|
|
//
|
|
|
|
import SwiftUI
|
|
import Bedrock
|
|
|
|
/// Bottom controls with page indicators and navigation buttons
|
|
struct OnboardingBottomControls: View {
|
|
|
|
@Binding var currentPage: Int
|
|
let totalPages: Int
|
|
let onSkip: () -> Void
|
|
let onFinish: () -> Void
|
|
|
|
var body: some View {
|
|
VStack(spacing: Design.Spacing.large) {
|
|
// Page indicators
|
|
HStack(spacing: Design.Spacing.small) {
|
|
ForEach(0..<totalPages, id: \.self) { index in
|
|
Capsule()
|
|
.fill(index == currentPage ? AppAccent.primary : AppTextColors.tertiary)
|
|
.frame(width: index == currentPage ? 24 : 8, height: 8)
|
|
.animation(.easeInOut(duration: 0.2), value: currentPage)
|
|
}
|
|
}
|
|
|
|
// Navigation buttons
|
|
HStack(spacing: Design.Spacing.large) {
|
|
Button {
|
|
if currentPage > 0 {
|
|
withAnimation { currentPage -= 1 }
|
|
} else {
|
|
onSkip()
|
|
}
|
|
} label: {
|
|
Text(currentPage == 0 ? "Skip" : "Back")
|
|
.typography(.bodyEmphasis)
|
|
.foregroundStyle(AppTextColors.secondary)
|
|
.frame(maxWidth: .infinity)
|
|
.padding(Design.Spacing.medium)
|
|
}
|
|
|
|
Button {
|
|
if currentPage < totalPages - 1 {
|
|
withAnimation { currentPage += 1 }
|
|
} else {
|
|
onFinish()
|
|
}
|
|
} label: {
|
|
Text(currentPage == totalPages - 1 ? "Get Started" : "Next")
|
|
.typography(.bodyEmphasis)
|
|
.foregroundStyle(.white)
|
|
.frame(maxWidth: .infinity)
|
|
.padding(Design.Spacing.medium)
|
|
.background(AppAccent.primary)
|
|
.clipShape(.rect(cornerRadius: Design.CornerRadius.medium))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// MARK: - Preview
|
|
|
|
#Preview {
|
|
OnboardingBottomControls(
|
|
currentPage: .constant(0),
|
|
totalPages: 4,
|
|
onSkip: {},
|
|
onFinish: {}
|
|
)
|
|
.padding()
|
|
.preferredColorScheme(.dark)
|
|
}
|