mirror of
https://github.com/phranck/TUIkit.git
synced 2026-05-21 09:50:35 +00:00
41 lines
837 B
Swift
41 lines
837 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(.palette.accent)
|
|
content
|
|
}
|
|
}
|
|
}
|