From 577c047e13ff034e3995f88a2b88e2825201a08d Mon Sep 17 00:00:00 2001 From: Sonia Sandler <66797193+SoniaSandler@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:17:42 -0500 Subject: [PATCH] chore: replace colors by using registry colors in ui (#9689) * chore: change hardcoded colors to color registry Signed-off-by: Sonia Sandler --- .../src/lib/ui/AuditMessageBox.svelte | 4 +-- packages/renderer/src/lib/ui/Badge.svelte | 2 +- .../lib/ui/ConnectionErrorInfoButton.svelte | 2 +- .../src/lib/ui/ConnectionStatus.spec.ts | 22 +++++++-------- .../src/lib/ui/ConnectionStatus.svelte | 24 ++++++++-------- .../src/lib/ui/ExtensionStatus.spec.ts | 24 ++++++++-------- .../src/lib/ui/ExtensionStatus.svelte | 28 +++++++++---------- .../renderer/src/lib/ui/PasswordInput.svelte | 2 +- .../src/lib/ui/ProviderResultPage.svelte | 6 ++-- packages/renderer/src/lib/ui/StatusDot.svelte | 2 +- 10 files changed, 58 insertions(+), 58 deletions(-) diff --git a/packages/renderer/src/lib/ui/AuditMessageBox.svelte b/packages/renderer/src/lib/ui/AuditMessageBox.svelte index 108fee99d5df8..47e5a1e819a5a 100644 --- a/packages/renderer/src/lib/ui/AuditMessageBox.svelte +++ b/packages/renderer/src/lib/ui/AuditMessageBox.svelte @@ -22,7 +22,7 @@ $: errorRecords = auditResult?.records.filter(record => record.type === 'error') aria-label="error">
- +
{record.record} @@ -40,7 +40,7 @@ $: errorRecords = auditResult?.records.filter(record => record.type === 'error') aria-label="warning">
- +
{record.record} diff --git a/packages/renderer/src/lib/ui/Badge.svelte b/packages/renderer/src/lib/ui/Badge.svelte index ce7802df1f57c..49066473aed67 100644 --- a/packages/renderer/src/lib/ui/Badge.svelte +++ b/packages/renderer/src/lib/ui/Badge.svelte @@ -26,6 +26,6 @@ onMount(async () => { }); -
+
{label}
diff --git a/packages/renderer/src/lib/ui/ConnectionErrorInfoButton.svelte b/packages/renderer/src/lib/ui/ConnectionErrorInfoButton.svelte index d94197830eab5..4db6b13032fab 100644 --- a/packages/renderer/src/lib/ui/ConnectionErrorInfoButton.svelte +++ b/packages/renderer/src/lib/ui/ConnectionErrorInfoButton.svelte @@ -7,6 +7,6 @@ export let status: IConnectionStatus | undefined; {#if status?.action && status?.error} {/if} diff --git a/packages/renderer/src/lib/ui/ConnectionStatus.spec.ts b/packages/renderer/src/lib/ui/ConnectionStatus.spec.ts index b89ef15602820..668c8fbb74d55 100644 --- a/packages/renderer/src/lib/ui/ConnectionStatus.spec.ts +++ b/packages/renderer/src/lib/ui/ConnectionStatus.spec.ts @@ -1,5 +1,5 @@ /********************************************************************** - * Copyright (C) 2023 Red Hat, Inc. + * Copyright (C) 2023-2024 Red Hat, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,9 +34,9 @@ test('Expect green text and icon when connection is running', async () => { const icon = screen.getByLabelText(connectionStatusIcon); const label = screen.getByLabelText(connectionStatusLabel); expect(icon).toBeInTheDocument(); - expect(icon).toHaveClass('bg-green-500'); + expect(icon).toHaveClass('bg-[var(--pd-status-running)]'); expect(label).toBeInTheDocument(); - expect(label).toHaveClass('text-green-500'); + expect(label).toHaveClass('text-[var(--pd-status-running)]'); expect(label).toHaveTextContent('RUNNING'); }); @@ -45,9 +45,9 @@ test('Expect green text and icon when connection is starting', async () => { const icon = screen.getByLabelText(connectionStatusIcon); const label = screen.getByLabelText(connectionStatusLabel); expect(icon).toBeInTheDocument(); - expect(icon).toHaveClass('bg-green-500'); + expect(icon).toHaveClass('bg-[var(--pd-status-starting)]'); expect(label).toBeInTheDocument(); - expect(label).toHaveClass('text-green-500'); + expect(label).toHaveClass('text-[var(--pd-status-starting)]'); expect(label).toHaveTextContent('STARTING'); }); @@ -56,9 +56,9 @@ test('Expect green text and icon when connection is stopped', async () => { const icon = screen.getByLabelText(connectionStatusIcon); const label = screen.getByLabelText(connectionStatusLabel); expect(icon).toBeInTheDocument(); - expect(icon).toHaveClass('bg-gray-900'); + expect(icon).toHaveClass('bg-[var(--pd-status-stopped)]'); expect(label).toBeInTheDocument(); - expect(label).toHaveClass('text-gray-900'); + expect(label).toHaveClass('text-[var(--pd-status-stopped)]'); expect(label).toHaveTextContent('OFF'); }); @@ -67,9 +67,9 @@ test('Expect green text and icon when connection is stopping', async () => { const icon = screen.getByLabelText(connectionStatusIcon); const label = screen.getByLabelText(connectionStatusLabel); expect(icon).toBeInTheDocument(); - expect(icon).toHaveClass('bg-red-500'); + expect(icon).toHaveClass('bg-[var(--pd-status-terminated)]'); expect(label).toBeInTheDocument(); - expect(label).toHaveClass('text-red-500'); + expect(label).toHaveClass('text-[var(--pd-status-terminated)]'); expect(label).toHaveTextContent('STOPPING'); }); @@ -78,8 +78,8 @@ test('Expect green text and icon when connection is unknown', async () => { const icon = screen.getByLabelText(connectionStatusIcon); const label = screen.getByLabelText(connectionStatusLabel); expect(icon).toBeInTheDocument(); - expect(icon).toHaveClass('bg-gray-900'); + expect(icon).toHaveClass('bg-[var(--pd-status-unknown)]'); expect(label).toBeInTheDocument(); - expect(label).toHaveClass('text-gray-900'); + expect(label).toHaveClass('text-[var(--pd-status-unknown)]'); expect(label).toHaveTextContent('UNKNOWN'); }); diff --git a/packages/renderer/src/lib/ui/ConnectionStatus.svelte b/packages/renderer/src/lib/ui/ConnectionStatus.svelte index 90e675b6673f1..0873e9c3b16d0 100644 --- a/packages/renderer/src/lib/ui/ConnectionStatus.svelte +++ b/packages/renderer/src/lib/ui/ConnectionStatus.svelte @@ -13,47 +13,47 @@ const statusesStyle = new Map([ [ 'started', { - bgColor: 'bg-green-500', - txtColor: 'text-green-500', + bgColor: 'bg-[var(--pd-status-running)]', + txtColor: 'text-[var(--pd-status-running)]', label: 'RUNNING', }, ], [ 'starting', { - bgColor: 'bg-green-500', - txtColor: 'text-green-500', + bgColor: 'bg-[var(--pd-status-starting)]', + txtColor: 'text-[var(--pd-status-starting)]', label: 'STARTING', }, ], [ 'stopped', { - bgColor: 'bg-gray-900', - txtColor: 'text-gray-900', + bgColor: 'bg-[var(--pd-status-stopped)]', + txtColor: 'text-[var(--pd-status-stopped)]', label: 'OFF', }, ], [ 'stopping', { - bgColor: 'bg-red-500', - txtColor: 'text-red-500', + bgColor: 'bg-[var(--pd-status-terminated)]', + txtColor: 'text-[var(--pd-status-terminated)]', label: 'STOPPING', }, ], [ 'failed', { - bgColor: 'bg-red-500', - txtColor: 'text-red-500', + bgColor: 'bg-[var(--pd-status-terminated)]', + txtColor: 'text-[var(--pd-status-terminated)]', label: 'FAILED', }, ], ]); $: statusStyle = statusesStyle.get(status) ?? { - bgColor: 'bg-gray-900', - txtColor: 'text-gray-900', + bgColor: 'bg-[var(--pd-status-unknown)]', + txtColor: 'text-[var(--pd-status-unknown)]', label: status.toUpperCase(), }; diff --git a/packages/renderer/src/lib/ui/ExtensionStatus.spec.ts b/packages/renderer/src/lib/ui/ExtensionStatus.spec.ts index 14b0aecea9fbd..313e7652af090 100644 --- a/packages/renderer/src/lib/ui/ExtensionStatus.spec.ts +++ b/packages/renderer/src/lib/ui/ExtensionStatus.spec.ts @@ -31,9 +31,9 @@ test('Expect green text and icon when extension is running', async () => { const icon = screen.getByLabelText(extensionStatusIcon); const label = screen.getByLabelText(extensionStatusLabel); expect(icon).toBeInTheDocument(); - expect(icon).toHaveClass('bg-green-500'); + expect(icon).toHaveClass('bg-[var(--pd-status-running)]'); expect(label).toBeInTheDocument(); - expect(label).toHaveClass('text-green-500'); + expect(label).toHaveClass('text-[var(--pd-status-running)]'); expect(label).toHaveTextContent('ACTIVE'); }); @@ -42,9 +42,9 @@ test('Expect green text and icon when extension is starting', async () => { const icon = screen.getByLabelText(extensionStatusIcon); const label = screen.getByLabelText(extensionStatusLabel); expect(icon).toBeInTheDocument(); - expect(icon).toHaveClass('bg-green-500'); + expect(icon).toHaveClass('bg-[var(--pd-status-starting)]'); expect(label).toBeInTheDocument(); - expect(label).toHaveClass('text-green-500'); + expect(label).toHaveClass('text-[var(--pd-status-starting)]'); expect(label).toHaveTextContent('ACTIVATING'); }); @@ -53,9 +53,9 @@ test('Expect green text and icon when extension is stopped', async () => { const icon = screen.getByLabelText(extensionStatusIcon); const label = screen.getByLabelText(extensionStatusLabel); expect(icon).toBeInTheDocument(); - expect(icon).toHaveClass('bg-gray-900'); + expect(icon).toHaveClass('bg-[var(--pd-status-stopped)]'); expect(label).toBeInTheDocument(); - expect(label).toHaveClass('text-gray-900'); + expect(label).toHaveClass('text-[var(--pd-status-stopped)]'); expect(label).toHaveTextContent('DISABLED'); }); @@ -64,9 +64,9 @@ test('Expect green text and icon when extension is stopping', async () => { const icon = screen.getByLabelText(extensionStatusIcon); const label = screen.getByLabelText(extensionStatusLabel); expect(icon).toBeInTheDocument(); - expect(icon).toHaveClass('bg-red-500'); + expect(icon).toHaveClass('bg-[var(--pd-status-terminated)]'); expect(label).toBeInTheDocument(); - expect(label).toHaveClass('text-red-500'); + expect(label).toHaveClass('text-[var(--pd-status-terminated)]'); expect(label).toHaveTextContent('DISABLING'); }); test('Expect green text and icon when extension is unknown', async () => { @@ -74,9 +74,9 @@ test('Expect green text and icon when extension is unknown', async () => { const icon = screen.getByLabelText(extensionStatusIcon); const label = screen.getByLabelText(extensionStatusLabel); expect(icon).toBeInTheDocument(); - expect(icon).toHaveClass('bg-gray-900'); + expect(icon).toHaveClass('bg-[var(--pd-status-unknown)]'); expect(label).toBeInTheDocument(); - expect(label).toHaveClass('text-gray-900'); + expect(label).toHaveClass('text-[var(--pd-status-unknown)]'); expect(label).toHaveTextContent('UNKNOWN'); }); @@ -85,8 +85,8 @@ test('Expect purple text and icon when extension is downloadable', async () => { const icon = screen.getByLabelText(extensionStatusIcon); const label = screen.getByLabelText(extensionStatusLabel); expect(icon).toBeInTheDocument(); - expect(icon).toHaveClass('bg-purple-600'); + expect(icon).toHaveClass('bg-[var(--pd-notification-dot)]'); expect(label).toBeInTheDocument(); - expect(label).toHaveClass('text-gray-700'); + expect(label).toHaveClass('text-[var(--pd-status-ready)]'); expect(label).toHaveTextContent('DOWNLOADABLE'); }); diff --git a/packages/renderer/src/lib/ui/ExtensionStatus.svelte b/packages/renderer/src/lib/ui/ExtensionStatus.svelte index 68f3bd47016f8..fab83e2d20735 100644 --- a/packages/renderer/src/lib/ui/ExtensionStatus.svelte +++ b/packages/renderer/src/lib/ui/ExtensionStatus.svelte @@ -12,55 +12,55 @@ const statusesStyle = new Map([ [ 'started', { - bgColor: 'bg-green-500', - txtColor: 'text-green-500', + bgColor: 'bg-[var(--pd-status-running)]', + txtColor: 'text-[var(--pd-status-running)]', label: 'ACTIVE', }, ], [ 'starting', { - bgColor: 'bg-green-500', - txtColor: 'text-green-500', + bgColor: 'bg-[var(--pd-status-starting)]', + txtColor: 'text-[var(--pd-status-starting)]', label: 'ACTIVATING', }, ], [ 'stopped', { - bgColor: 'bg-gray-900', - txtColor: 'text-gray-900', + bgColor: 'bg-[var(--pd-status-stopped)]', + txtColor: 'text-[var(--pd-status-stopped)]', label: 'DISABLED', }, ], [ 'stopping', { - bgColor: 'bg-red-500', - txtColor: 'text-red-500', + bgColor: 'bg-[var(--pd-status-terminated)]', + txtColor: 'text-[var(--pd-status-terminated)]', label: 'DISABLING', }, ], [ 'failed', { - bgColor: 'bg-red-500', - txtColor: 'text-red-500', + bgColor: 'bg-[var(--pd-status-terminated)]', + txtColor: 'text-[var(--pd-status-terminated)]', label: 'FAILED', }, ], [ 'downloadable', { - bgColor: 'bg-purple-600', - txtColor: 'text-gray-700', + bgColor: 'bg-[var(--pd-notification-dot)]', + txtColor: 'text-[var(--pd-status-ready)]', label: 'DOWNLOADABLE', }, ], ]); $: statusStyle = statusesStyle.get(status) ?? { - bgColor: 'bg-gray-900', - txtColor: 'text-gray-900', + bgColor: 'bg-[var(--pd-status-unknown)]', + txtColor: 'text-[var(--pd-status-unknown)]', label: status.toUpperCase(), }; diff --git a/packages/renderer/src/lib/ui/PasswordInput.svelte b/packages/renderer/src/lib/ui/PasswordInput.svelte index 0d34b95c09880..2554898f9689b 100644 --- a/packages/renderer/src/lib/ui/PasswordInput.svelte +++ b/packages/renderer/src/lib/ui/PasswordInput.svelte @@ -38,7 +38,7 @@ async function onShowHide() { bind:element={element}>
{#if number} -
{number}
+
{number}
{/if}