aboutsummaryrefslogtreecommitdiff
path: root/Sources/NorgUI/Views/VerbatimBlock.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Sources/NorgUI/Views/VerbatimBlock.swift')
-rw-r--r--Sources/NorgUI/Views/VerbatimBlock.swift23
1 files changed, 23 insertions, 0 deletions
diff --git a/Sources/NorgUI/Views/VerbatimBlock.swift b/Sources/NorgUI/Views/VerbatimBlock.swift
new file mode 100644
index 0000000..722c3f3
--- /dev/null
+++ b/Sources/NorgUI/Views/VerbatimBlock.swift
@@ -0,0 +1,23 @@
+import SwiftUI
+
+struct VerbatimBlock: View {
+ @Environment(\.norgTheme) private var theme
+
+ let label: String?
+ let content: String
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 4) {
+ if let label, !label.isEmpty {
+ Text(label)
+ .font(.caption2)
+ .foregroundStyle(.secondary)
+ }
+ Text(content)
+ .font(theme.codeFont)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ }
+ .padding(10)
+ .background(theme.codeBackground, in: RoundedRectangle(cornerRadius: 8))
+ }
+}