mirror of
https://github.com/phranck/TUIkit.git
synced 2026-06-20 09:54:37 +00:00
- Add LICENSE file (MIT) - Update 141 Swift file headers: CC BY-NC-SA 4.0 → License: MIT
40 lines
845 B
Swift
40 lines
845 B
Swift
// 🖥️ TUIKit — Terminal UI Kit for Swift
|
|
// DemoSection.swift
|
|
//
|
|
// Created by LAYERED.work
|
|
// License: MIT
|
|
|
|
import TUIkit
|
|
|
|
/// A section with a styled title and content.
|
|
///
|
|
/// Used to group related demo content with a yellow underlined title.
|
|
///
|
|
/// # Example
|
|
///
|
|
/// ```swift
|
|
/// DemoSection("Basic Features") {
|
|
/// Text("Feature 1")
|
|
/// Text("Feature 2")
|
|
/// }
|
|
/// ```
|
|
struct DemoSection<Content: View>: View {
|
|
let title: String
|
|
let content: Content
|
|
|
|
init(_ title: String, @ViewBuilder content: () -> Content) {
|
|
self.title = title
|
|
self.content = content()
|
|
}
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading) {
|
|
Text(title)
|
|
.bold()
|
|
.underline()
|
|
.foregroundColor(.palette.accent)
|
|
content
|
|
}
|
|
}
|
|
}
|