38 lines · 1.3 KB · SwiftRaw
// A person on a face: their picture in a round mount — the photograph the// core named for them, drawn through the picture hook (`FacePicture`: the// phone's in the app, the fixtures' in Loom) — or, when they have none, their// initials on the grey mount.import CottonPaperimport SwiftUIpublic struct FaceMount: View { let name: String let picture: String? let size: CGFloat let typed: Bool @Environment(\.theme) private var theme public init(name: String, picture: String?, size: CGFloat, typed: Bool = false) { self.name = name self.picture = picture self.size = size self.typed = typed } public var body: some View { Group { if let picture, !picture.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { FacePicture(key: picture, edge: size * 3) } else { InitialsMount(name: name, typed: typed) } } .frame(width: size, height: size) .clipShape(Circle()) .overlay(Circle().stroke(theme.faceStocks.printMount, lineWidth: 2)) .shadow(color: theme.colors.shadow.color.opacity(0.18), radius: 1.5, x: 0, y: 1) .accessibilityElement(children: .ignore) .accessibilityLabel(name) }}