feat: Adds stacks, working on styles

This commit is contained in:
2024-12-04 10:40:39 -05:00
parent 46c2c7ad31
commit 10119c3e51
12 changed files with 232 additions and 107 deletions

View File

@@ -0,0 +1,22 @@
public struct VStack: TextNode {
@usableFromInline
let content: [any TextNode]
@usableFromInline
let separator: any TextNode
@inlinable
public init(
spacing: Int = 1,
@TextBuilder content: () -> any TextNode
) {
self.content = array(from: content())
self.separator = seperator("\n", count: spacing > 0 ? spacing - 1 : 0)
}
@inlinable
public var body: some TextNode {
content.map { $0.render() }.joined(separator: separator.render())
}
}