aboutsummaryrefslogtreecommitdiff
path: root/Sources/NorgUI/Views/Blocks/HeadingView.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Sources/NorgUI/Views/Blocks/HeadingView.swift')
-rw-r--r--Sources/NorgUI/Views/Blocks/HeadingView.swift26
1 files changed, 26 insertions, 0 deletions
diff --git a/Sources/NorgUI/Views/Blocks/HeadingView.swift b/Sources/NorgUI/Views/Blocks/HeadingView.swift
new file mode 100644
index 0000000..3b65134
--- /dev/null
+++ b/Sources/NorgUI/Views/Blocks/HeadingView.swift
@@ -0,0 +1,26 @@
+import NorgKit
+import SwiftUI
+
+struct HeadingView: View {
+ @Environment(\.norgTheme) private var theme
+
+ let level: Int
+ let status: TaskStatus?
+ let content: [InlineSpan]
+ let line: Int
+ let onSetStatus: (Int, TaskStatus) -> Void
+
+ var body: some View {
+ let font = theme.heading(level)
+ Group {
+ if let status {
+ BlockTaskRow(
+ status: status, content: content, font: font, line: line, onSetStatus: onSetStatus)
+ } else {
+ Text(AttributedString(norg: content, baseFont: font, theme: theme))
+ .font(font)
+ }
+ }
+ .padding(.top, 4)
+ }
+}