aboutsummaryrefslogtreecommitdiff
path: root/Sources/NorgUI/Views/Blocks/ListItemView.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Sources/NorgUI/Views/Blocks/ListItemView.swift')
-rw-r--r--Sources/NorgUI/Views/Blocks/ListItemView.swift27
1 files changed, 27 insertions, 0 deletions
diff --git a/Sources/NorgUI/Views/Blocks/ListItemView.swift b/Sources/NorgUI/Views/Blocks/ListItemView.swift
new file mode 100644
index 0000000..581974b
--- /dev/null
+++ b/Sources/NorgUI/Views/Blocks/ListItemView.swift
@@ -0,0 +1,27 @@
+import NorgKit
+import SwiftUI
+
+struct ListItemView: View {
+ @Environment(\.norgTheme) private var theme
+
+ let marker: String
+ let status: TaskStatus?
+ let content: [InlineSpan]
+ let line: Int
+ let onSetStatus: (Int, TaskStatus) -> Void
+
+ var body: some View {
+ HStack(alignment: .firstTextBaseline, spacing: 8) {
+ if let status {
+ BlockTaskRow(
+ status: status, content: content, font: theme.body, line: line, onSetStatus: onSetStatus
+ )
+ } else {
+ Text(marker)
+ .foregroundStyle(.secondary)
+ .monospacedDigit()
+ Text(AttributedString(norg: content, theme: theme))
+ }
+ }
+ }
+}