Files
TUIkit/Sources/TUIKitExample/Components/HeaderView.swift
T
phranck f00d919c1f feat: Use theme colors in StatusBar and Example App
- StatusBar now uses theme colors by default (statusBarHighlight, statusBarForeground)
- Example App MainMenuPage uses theme colors (accent, border, foreground*)
- Example App HeaderView uses theme colors
- Theme switching ('t' key) now shows visible changes
2026-01-28 20:50:28 +01:00

51 lines
1.1 KiB
Swift

//
// HeaderView.swift
// TUIKitExample
//
// A reusable header component for demo pages.
//
import TUIKit
/// A styled header with title on the left and version on the right.
///
/// Used at the top of each demo page to provide consistent branding
/// and optional subtitle.
///
/// # Example
///
/// ```swift
/// HeaderView(
/// title: "My Demo",
/// subtitle: "An optional description"
/// )
/// ```
struct HeaderView: View {
let title: String
let subtitle: String?
init(title: String, subtitle: String? = nil) {
self.title = title
self.subtitle = subtitle
}
var body: some View {
VStack {
HStack {
Text(title)
.bold()
.foregroundColor(.theme.accent)
Spacer()
Text("TUIKit v\(tuiKitVersion)")
.foregroundColor(.theme.foregroundTertiary)
}
if let sub = subtitle {
Text(sub)
.foregroundColor(.theme.foregroundSecondary)
.italic()
}
Divider(character: "═")
}
}
}