mirror of
https://github.com/phranck/TUIkit.git
synced 2026-05-21 09:50:35 +00:00
51 lines
1.2 KiB
Swift
51 lines
1.2 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(.palette.accent)
|
|
Spacer()
|
|
Text("TUIkit v\(tuiKitVersion)")
|
|
.foregroundColor(.palette.foregroundTertiary)
|
|
}
|
|
if let subtitleText = subtitle {
|
|
Text(subtitleText)
|
|
.foregroundColor(.palette.foregroundSecondary)
|
|
.italic()
|
|
}
|
|
Divider(character: "═")
|
|
}
|
|
}
|
|
}
|