TheNoiseClock/TheNoiseClock/Features/Clock/Views/Components/ClockDisplayContainer.swift

60 lines
1.9 KiB
Swift

//
// ClockDisplayContainer.swift
// TheNoiseClock
//
// Created by Matt Bruce on 9/8/25.
//
import SwiftUI
import Bedrock
/// Container component that handles the main clock display layout and scaling
struct ClockDisplayContainer: View {
// MARK: - Properties
let currentTime: Date
let style: ClockStyle
let isFullScreenMode: Bool
// MARK: - Body
var body: some View {
GeometryReader { geometry in
let isPortrait = geometry.size.height >= geometry.size.width
let hasOverlay = style.showBattery || style.showDate || style.showNextAlarm || style.showNoiseControls
let topSpacing = hasOverlay ? (isPortrait ? Design.Spacing.xxLarge : Design.Spacing.large) : 0
// Time display - fills all available space
TimeDisplayView(
date: currentTime,
use24Hour: style.use24Hour,
showSeconds: style.showSeconds,
showAmPm: style.showAmPm,
digitColor: style.effectiveDigitColor,
glowIntensity: style.glowIntensity,
clockOpacity: style.clockOpacity,
fontFamily: style.fontFamily,
fontWeight: style.fontWeight,
fontDesign: style.fontDesign,
forceHorizontalMode: style.forceHorizontalMode,
isDisplayMode: isFullScreenMode,
animationStyle: style.digitAnimationStyle
)
.padding(.top, topSpacing)
.frame(width: geometry.size.width, height: geometry.size.height)
.transition(.opacity)
.animation(.smooth(duration: Design.Animation.standard), value: isFullScreenMode)
}
}
}
// MARK: - Preview
#Preview {
ClockDisplayContainer(
currentTime: Date(),
style: ClockStyle(),
isFullScreenMode: false
)
.frame(width: 400, height: 600)
.background(Color.black)
}