SPB Git

Repository Public

FolderRow.swift 1.3 KB 42 lines swift

1// SP Notes iOS2// File: Components/FolderRow.swift3// Description: One folder (or any titled entry with a symbol and a count) in a list or in the sidebar.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7import SPNotesCore8import SwiftUI910struct FolderRow: View {11    let title: String12    var symbol = "folder"13    var count: Int?14    var tint: Color = .accentColor1516    init(folder: PageSummary) {17        title = AppModel.displayTitle(folder.title)18        symbol = "folder"19    }2021    init(title: String, symbol: String = "folder", count: Int? = nil, tint: Color = .accentColor) {22        self.title = title; self.symbol = symbol; self.count = count; self.tint = tint23    }2425    var body: some View {26        HStack(spacing: 12) {27            Label {28                Text(title).foregroundStyle(Color.spText).lineLimit(2)29            } icon: {30                Image(systemName: symbol).foregroundStyle(tint)31            }32            Spacer(minLength: 8)33            if let count, count > 0 {34                Text(count, format: .number).font(.subheadline).monospacedDigit().foregroundStyle(Color.spTextSecondary)35            }36        }37        .frame(minHeight: 30)38        .contentShape(Rectangle())39        .accessibilityElement(children: .combine)40    }41}42
Files main
Menu

Theme