// A quiet typed row on the plaster — the verbs under an object. // // The open key tag's "Put on a machine", a settings line: a thing a person // can DO or OPEN next to an object, which is not itself a piece of paper. Picture 26 draws them as typewriter words with a // pencil glyph before them, a chevron after, and a hairline under each — no // card, no fill, nothing that competes with the object above. // // It is not `SettingsRow` restyled. That row is chrome inside a white card; // this one stands on the ground a paper screen already painted, and sets its // words in the typewriter because it sits among objects rather than in a form. import SwiftUI public struct TypedRow: View { @Environment(\.theme) private var theme @Environment(\.openedCardGround) private var ground private let symbol: String? private let label: String private let detail: String? private let chevron: Bool private let destructive: Bool private let action: () -> Void public init( symbol: String? = nil, label: String, detail: String? = nil, chevron: Bool = true, destructive: Bool = false, action: @escaping () -> Void ) { self.symbol = symbol self.label = label self.detail = detail self.chevron = chevron self.destructive = destructive self.action = action } public var body: some View { Button(action: action) { VStack(spacing: 0) { HStack(alignment: .center, spacing: TypedRowKnobs.typedRowGap) { if let symbol { Image(systemName: Glyph.symbol(symbol) ?? symbol) .font(theme.type.interface(TypedRowKnobs.typedRowGlyphSize, weight: .regular)) .foregroundStyle(destructive ? theme.colors.error.color : (DeckGround.own(ground) ? DeckGround.ink(.pencil, on: ground, theme: theme) : theme.colors.inkSecondary.color)) .frame(width: TypedRowKnobs.typedRowGlyphWidth) } VStack(alignment: .leading, spacing: TypedRowKnobs.typedRowStackGap) { Text(label) .font(theme.type.body(theme.scale.bodySize + 1)) .foregroundStyle(destructive ? theme.colors.error.color : (DeckGround.own(ground) ? DeckGround.ink(.ink, on: ground, theme: theme) : theme.colors.ink.color)) .lineLimit(TypedRowKnobs.typedRowLines) .multilineTextAlignment(.leading) if let detail { Text(detail) .font(theme.type.body(theme.scale.bodySize - 2)) .foregroundStyle(DeckGround.own(ground) ? DeckGround.ink(.pencil, on: ground, theme: theme) : theme.colors.inkTertiary.color) .lineLimit(TypedRowKnobs.typedRowLines) .multilineTextAlignment(.leading) } } Spacer(minLength: TypedRowKnobs.typedRowChevronMinGap) if chevron { Image(systemName: "chevron.right") .font(theme.type.interface(TypedRowKnobs.typedRowChevronSize, weight: .medium)) .foregroundStyle(DeckGround.own(ground) ? DeckGround.ink(.pencil, on: ground, theme: theme) : theme.colors.inkTertiary.color) } } .padding(.vertical, TypedRowKnobs.typedRowVerticalInset) Rectangle() .fill(theme.colors.hairline.color) .frame(height: theme.scale.hairline) } .padding(.horizontal, TypedRowKnobs.typedRowHorizontalInset) .contentShape(Rectangle()) } .buttonStyle(OpacityButtonStyle()) } } /// The sizes, counts and timings TypedRow draws with: Swift's own, beside /// their reader — a theme sets only its tokens (`scale.tokens`). enum TypedRowKnobs { static let typedRowChevronMinGap: CGFloat = 8 static let typedRowChevronSize: CGFloat = 13 static let typedRowGap: CGFloat = 16 static let typedRowGlyphSize: CGFloat = 16 static let typedRowGlyphWidth: CGFloat = 26 static let typedRowHorizontalInset: CGFloat = 6 static let typedRowLines = 2 static let typedRowStackGap: CGFloat = 3 static let typedRowVerticalInset: CGFloat = 15 }