// The pieces the first run and the four gate screens are printed with. // // The first screen, the refusal slip and the migration sheet share a small // vocabulary on the paper kit, and it lives here once rather than three // times: the ink pill for a gate's way forward, a typewriter line for a quiet // action, a pencil rule, and the plaster ground. // // Nothing here is `public`: these are parts of screens, not design-system // primitives. // // Every colour is a palette role or a paper ink. import CottonKit import SwiftUI // MARK: - The ink /// The ink pill — a gate's one way forward, with its verb typed on it. struct InkPillButton: View { let label: String let identifier: String let action: () -> Void var body: some View { Button(action: action) { Text(label) .font(CottonFonts.type(16)) .foregroundStyle(CottonColors.ground) .lineLimit(1) .padding(.horizontal, 22) .frame(minHeight: 48) .background(Capsule().fill(CottonColors.ink)) .liftShadow() .contentShape(Capsule()) } .buttonStyle(MotionButtonStyle()) .accessibilityIdentifier(identifier) } } /// A quiet action typed on the paper: the verb, and a small arrow at the /// right. In red ink when it deletes something. struct TypewriterLine: View { let label: String let identifier: String var ink: PaperInk = .ink var disabled = false let action: () -> Void @Environment(\.theme) private var theme var body: some View { Button(action: action) { HStack(spacing: 10) { Text(label) .font(CottonFonts.type(15)) .foregroundStyle(theme.print(ink)) .multilineTextAlignment(.leading) .fixedSize(horizontal: false, vertical: true) // The words take the row and the arrow keeps its own width. // A `Spacer` here split the row with the words, so a line // that fits on one broke onto two at half the width. .frame(maxWidth: .infinity, alignment: .leading) Image(systemName: "arrow.right") .font(.system(size: 13, weight: .regular)) .foregroundStyle(theme.print(ink == .red ? .red : .pencil)) } .frame(minHeight: 44) .contentShape(Rectangle()) } .buttonStyle(MotionButtonStyle()) .disabled(disabled) .opacity(disabled ? DisabledOpacity.control : 1) .accessibilityIdentifier(identifier) } } /// A hand-ruled hairline across the paper. struct PaperRuleLine: View { var seed = "rule" var ink: PaperInk = .pencil @Environment(\.theme) private var theme var body: some View { PencilRule(seed: seed, theme: theme) .stroke(theme.print(ink), lineWidth: ink == .red ? 1.4 : 1) .frame(height: 3) .accessibilityHidden(true) } } // MARK: - The ground /// The plaster every first-run and gate screen stands on — Home's, so the /// seam from the splash into the first screen and into Home is one material. struct PlasterGround: View { var body: some View { PageGroundFill() .cottonPageGround(.groundMuted) .cottonPageTexture(.plaster) // Ground. .accessibilityHidden(true) } }