mirror of
https://github.com/phranck/TUIkit.git
synced 2026-06-20 09:54:37 +00:00
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.
41 lines
829 B
Swift
41 lines
829 B
Swift
//
|
|
// DemoSection.swift
|
|
// TUIKitExample
|
|
//
|
|
// A reusable section component for organizing demo content.
|
|
//
|
|
|
|
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(.yellow)
|
|
content
|
|
}
|
|
}
|
|
}
|