// A word on a little cut slip of paper laid on a card: a mood's emotions, // a meeting's speakers (house references 95, 97 and 98). import CottonPaper import SwiftUI enum PaperChipKnobs { static let size: CGFloat = 15 static let pad = EdgeInsets(top: 7, leading: 16, bottom: 7, trailing: 16) static let corner: CGFloat = 3 static let pill: CGFloat = 40 static let shadow: CGFloat = 0.24 } /// A word on a little cut slip of paper laid on the card — a mood's emotion, /// a meeting's speaker; `round`, a pill of it. Never cut mid-word: a slip /// takes the room its word needs. struct PaperChip: View { let words: String var round = false @Environment(\.theme) private var theme var body: some View { Text(words) .font(CottonFonts.type(PaperChipKnobs.size)) .lineLimit(1) .fixedSize() .faceInk(.ink) .padding(PaperChipKnobs.pad) .background( PaperSurface(dye: .cream, edge: .cut, seed: "chip-\(words)") .clipShape(RoundedRectangle(cornerRadius: round ? PaperChipKnobs.pill : PaperChipKnobs.corner)) .shadow(color: theme.colors.shadow.color.opacity(PaperChipKnobs.shadow), radius: 1.6, x: 0, y: 1.2) ) } }