From 90ea3e6f79c837fdaa22e000c8185e9f5638a99b Mon Sep 17 00:00:00 2001 From: RachelRadford21 Date: Mon, 24 Jun 2024 15:14:19 -0400 Subject: [PATCH 1/4] fix colors for pill kit --- .../Color.xcassets/Status/Neutral.colorset/Contents.json | 6 +++--- .../Color.xcassets/Status/Warning.colorset/Contents.json | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/Playbook/Design Elements/Colors/Color.xcassets/Status/Neutral.colorset/Contents.json b/Sources/Playbook/Design Elements/Colors/Color.xcassets/Status/Neutral.colorset/Contents.json index 7fee7e0f2..bb6df9bb5 100644 --- a/Sources/Playbook/Design Elements/Colors/Color.xcassets/Status/Neutral.colorset/Contents.json +++ b/Sources/Playbook/Design Elements/Colors/Color.xcassets/Status/Neutral.colorset/Contents.json @@ -5,9 +5,9 @@ "color-space" : "srgb", "components" : { "alpha" : "1.000", - "blue" : "214", - "green" : "205", - "red" : "193" + "blue" : "135", + "green" : "120", + "red" : "104" } }, "idiom" : "universal" diff --git a/Sources/Playbook/Design Elements/Colors/Color.xcassets/Status/Warning.colorset/Contents.json b/Sources/Playbook/Design Elements/Colors/Color.xcassets/Status/Warning.colorset/Contents.json index d2de33ecc..d3537b960 100644 --- a/Sources/Playbook/Design Elements/Colors/Color.xcassets/Status/Warning.colorset/Contents.json +++ b/Sources/Playbook/Design Elements/Colors/Color.xcassets/Status/Warning.colorset/Contents.json @@ -6,8 +6,8 @@ "components" : { "alpha" : "1.000", "blue" : "0x00", - "green" : "0xBB", - "red" : "0xF9" + "green" : "0x95", + "red" : "0xC6" } }, "idiom" : "universal" From f249047387d4cd4a7392e825a95771b9ad5350ca Mon Sep 17 00:00:00 2001 From: RachelRadford21 Date: Fri, 20 Sep 2024 11:23:16 -0400 Subject: [PATCH 2/4] spacing commit --- .../Playbook/Resources/Helper Files/Mocks.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Sources/Playbook/Resources/Helper Files/Mocks.swift b/Sources/Playbook/Resources/Helper Files/Mocks.swift index f746baf59..d726f43fa 100644 --- a/Sources/Playbook/Resources/Helper Files/Mocks.swift +++ b/Sources/Playbook/Resources/Helper Files/Mocks.swift @@ -11,7 +11,7 @@ import SwiftUI enum Mocks { - static let andrew = PBUser(name: "Andrew Black", nameFont: .init(font: .title4, variant: .bold), image: Image("andrew", bundle: .module), size: .small, title: "Senior User Experience Engineer") + static let andrew = PBUser(name: "Andrew Black", nameFont: .init(font: .title4, variant: .bold), image: Image("andrew", bundle: .module), size: .small, title: "Senior User Experience Engineer") static let ana = PBUser(name: "Ana Black", nameFont: .init(font: .title4, variant: .bold), image: Image("Anna", bundle: .module), size: .small, title: "Senior User Experience Engineer") static let patric = PBUser(name: "Pat Black", nameFont: .init(font: .title4, variant: .bold), image: Image("Pat", bundle: .module), size: .small, title: "Senior User Experience Engineer") static let luccile = PBUser(name: "Luccile Black", nameFont: .init(font: .title4, variant: .bold), image: Image("Lu", bundle: .module), size: .small, title: "Senior User Experience Engineer") @@ -19,12 +19,12 @@ enum Mocks { static let twoUsers = [andrew, ana] static let threeUsers = [andrew, ana, patric] static let multipleUsers = [andrew, ana, patric, luccile] - static let multipleUsersDictionary: [(String, (String, (() -> PBUser?)?)?)] = [ - ("1", (andrew.name, { andrew })), - ("2", (ana.name, { ana })), - ("3", (patric.name, { patric })), - ("4", (luccile.name, { luccile })) - ] + static let multipleUsersDictionary: [(String, (String, (() -> PBUser?)?)?)] = [ + ("1", (andrew.name, { andrew })), + ("2", (ana.name, { ana })), + ("3", (patric.name, { patric })), + ("4", (luccile.name, { luccile })) + ] static let avatarXSmall = PBAvatar(image: Image("andrew", bundle: .module), size: .xSmall) static let avatarXSmallStatus = PBAvatar(image: Image("andrew", bundle: .module), size: .xSmall, status: .online) static let userName = "Andrew Black" From 76c280184a215271a4ef70ea188833b5f0aceb6f Mon Sep 17 00:00:00 2001 From: "isis.silva" Date: Fri, 20 Sep 2024 11:53:07 -0400 Subject: [PATCH 3/4] fix status color --- .../Online Status/PBOnlineStatus.swift | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/Sources/Playbook/Components/Online Status/PBOnlineStatus.swift b/Sources/Playbook/Components/Online Status/PBOnlineStatus.swift index 0d7a558dc..75a6f8400 100644 --- a/Sources/Playbook/Components/Online Status/PBOnlineStatus.swift +++ b/Sources/Playbook/Components/Online Status/PBOnlineStatus.swift @@ -10,7 +10,7 @@ import SwiftUI public struct PBOnlineStatus: View { - let status: Status + let status: Status? let color: Color? let size: Size let borderColor: Color? @@ -18,7 +18,7 @@ public struct PBOnlineStatus: View { @Environment(\.colorScheme) var colorScheme public init( - status: Status = .online, + status: Status? = nil, color: Color? = nil, size: Size = .small, borderColor: Color? = .white, @@ -56,10 +56,10 @@ public extension PBOnlineStatus { if let color = color { return color } else { - switch status { - case .online: return .status(.success) - case .offline: return .status(.error) - case .away: return . status(.warning) + if let status = status { + return status.color + } else { + return .status(.neutral) } } } @@ -91,13 +91,27 @@ public extension PBOnlineStatus { } enum Status { - case online, offline, away + case away + case error + case info + case neutral + case offline + case online + case primary + case success + case warning var color: Color { switch self { case .online: return .status(.success) case .away: return .status(.warning) case .offline: return .status(.neutral) + case .error: return .status(.error) + case .info: return .status(.info) + case .neutral: return .status(.neutral) + case .primary: return .pbPrimary + case .success: return .status(.success) + case .warning: return .status(.warning) } } } From c4364161298ab617d246328f46ef3d1ce1833440 Mon Sep 17 00:00:00 2001 From: "isis.silva" Date: Fri, 20 Sep 2024 12:19:37 -0400 Subject: [PATCH 4/4] fix avatar status color --- .../Components/Avatar/AvatarCatalog.swift | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/Sources/Playbook/Components/Avatar/AvatarCatalog.swift b/Sources/Playbook/Components/Avatar/AvatarCatalog.swift index 499ab059d..7b6a80a65 100644 --- a/Sources/Playbook/Components/Avatar/AvatarCatalog.swift +++ b/Sources/Playbook/Components/Avatar/AvatarCatalog.swift @@ -21,6 +21,9 @@ public struct AvatarCatalog: View { PBDoc(title: "Status Size") { statusSize } + PBDoc(title: "Status color") { + statusColor + } } } } @@ -50,9 +53,35 @@ extension AvatarCatalog { var statusSize: some View { VStack(alignment: .leading, spacing: Spacing.small) { - PBAvatar(image: Image("andrew", bundle: .module), size: .medium, status: .online, statusSize: .small) - PBAvatar(image: Image("andrew", bundle: .module), size: .medium, status: .away, statusSize: .medium) - PBAvatar(image: Image("andrew", bundle: .module), size: .medium, status: .offline, statusSize: .large) + VStack(spacing: Spacing.xxSmall) { + PBAvatar(image: Image("andrew", bundle: .module), size: .small, status: .online, statusSize: .medium) + Text("Small").pbFont(.caption) + } + VStack(spacing: Spacing.xxSmall) { + PBAvatar(image: Image("andrew", bundle: .module), size: .medium, status: .away, statusSize: .medium) + Text("Medium").pbFont(.caption) + } + VStack(spacing: Spacing.xxSmall) { + PBAvatar(image: Image("andrew", bundle: .module), size: .large, status: .offline, statusSize: .medium) + Text("Large").pbFont(.caption) + } + } + } + + var statusColor: some View { + VStack(alignment: .leading, spacing: Spacing.small) { + VStack(spacing: Spacing.xxSmall) { + PBAvatar(image: Image("andrew", bundle: .module), size: .medium, status: .online, statusSize: .medium) + Text("Online").pbFont(.caption) + } + VStack(spacing: Spacing.xxSmall) { + PBAvatar(image: Image("andrew", bundle: .module), size: .medium, status: .away, statusSize: .medium) + Text("Away").pbFont(.caption) + } + VStack(spacing: Spacing.xxSmall) { + PBAvatar(image: Image("andrew", bundle: .module), size: .medium, status: .offline, statusSize: .medium) + Text("Offline").pbFont(.caption) + } } } }