mirror of
https://github.com/phranck/TUIkit.git
synced 2026-05-21 09:50:35 +00:00
f77cd8bdec
Update IDETemplateMacros.plist and replace headers in 136 Swift files with
new format: 🖥️ TUIKit — Terminal UI Kit for Swift. Remove sdsd.swift template draft.
50 lines
1.2 KiB
Swift
50 lines
1.2 KiB
Swift
// 🖥️ TUIKit — Terminal UI Kit for Swift
|
||
// HeaderView.swift
|
||
//
|
||
// Created by LAYERED.work
|
||
// CC BY-NC-SA 4.0
|
||
|
||
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: "═")
|
||
}
|
||
}
|
||
}
|