aboutsummaryrefslogtreecommitdiff
path: root/Sources/NorgUI/Views/Blocks/RangeableBlockView.swift
blob: 433d89e8e08a12124d93167c892327385172e0b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import NorgKit
import SwiftUI

struct RangeableBlockView: View {
  @Environment(\.norgTheme) private var theme

  let title: [InlineSpan]
  let status: TaskStatus?
  let line: Int
  let onSetStatus: (Int, TaskStatus) -> Void

  var body: some View {
    if let status {
      BlockTaskRow(
        status: status, content: title, font: theme.termFont, line: line, onSetStatus: onSetStatus
      )
    } else {
      Text(AttributedString(norg: title, baseFont: theme.termFont, theme: theme))
        .font(theme.termFont)
    }
  }
}