mirror of
https://github.com/phranck/TUIkit.git
synced 2026-05-21 09:50:35 +00:00
45e73faafb
BREAKING CHANGE: Package name changed due to name collision with existing rensbreur/SwiftTUI package. Changes: - Rename package from SwiftTUI to TUIKit in Package.swift - Rename Sources/SwiftTUI to Sources/TUIKit - Rename Sources/SwiftTUIExample to Sources/TUIKitExample - Rename Tests/SwiftTUITests to Tests/TUIKitTests - Rename SwiftTUI.swift to TUIKit.swift - Update all imports: import SwiftTUI -> import TUIKit - Update all code references: SwiftTUI.renderToBuffer -> TUIKit.renderToBuffer - Update documentation comments - Rename swiftTUIVersion to tuiKitVersion All 181 tests passing.
51 lines
1.1 KiB
Swift
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(.cyan)
|
|
Spacer()
|
|
Text("TUIKit v\(tuiKitVersion)")
|
|
.dim()
|
|
}
|
|
if let sub = subtitle {
|
|
Text(sub)
|
|
.dim()
|
|
.italic()
|
|
}
|
|
Divider(character: "═")
|
|
}
|
|
}
|
|
}
|