From a2e81798ef343dcac5e3877daf42c7768ec07dc2 Mon Sep 17 00:00:00 2001 From: barsa Date: Tue, 16 Dec 2025 18:12:12 +0900 Subject: [PATCH] Refactor color tokens across components for improved consistency and clarity - Removed legacy color aliases from globals.css to streamline design tokens. - Updated various components, including Badge, Button, Checkbox, and Input, to utilize new color tokens for error states. - Enhanced error messaging styles in components like ErrorBoundary and AlertBanner for better visual coherence. - Standardized color usage in billing and subscription components to align with updated design tokens. - Improved overall styling consistency across the application by adopting the new color system. --- apps/portal/src/app/globals.css | 7 ------- apps/portal/src/components/atoms/badge.tsx | 4 ++-- apps/portal/src/components/atoms/button.tsx | 2 +- apps/portal/src/components/atoms/checkbox.tsx | 6 +++--- apps/portal/src/components/atoms/input.tsx | 2 +- apps/portal/src/components/atoms/status-pill.tsx | 2 +- .../components/molecules/AlertBanner/AlertBanner.tsx | 8 ++++---- .../src/components/molecules/FormField/FormField.tsx | 7 +++---- .../src/components/molecules/error-boundary.tsx | 2 +- .../src/features/account/components/AddressCard.tsx | 2 +- .../components/SetPasswordForm/SetPasswordForm.tsx | 2 +- .../auth/components/SignupForm/SignupForm.tsx | 2 +- .../auth/components/SignupForm/steps/AccountStep.tsx | 2 +- .../components/SignupForm/steps/PasswordStep.tsx | 2 +- .../auth/components/SignupForm/steps/ReviewStep.tsx | 2 +- .../components/BillingSummary/BillingSummary.tsx | 2 +- .../components/InvoiceDetail/InvoiceSummaryBar.tsx | 2 +- .../billing/components/InvoiceTable/InvoiceTable.tsx | 6 +++--- .../PaymentMethodCard/PaymentMethodCard.tsx | 2 +- .../catalog/components/sim/ActivationForm.tsx | 4 +--- .../catalog/components/sim/SimConfigureView.tsx | 2 +- .../src/features/dashboard/components/TaskCard.tsx | 8 ++++---- .../src/features/dashboard/views/DashboardView.tsx | 2 +- .../portal/src/features/orders/views/OrderDetail.tsx | 2 +- .../sim-management/components/DataUsageChart.tsx | 12 ++++++------ .../sim-management/components/SimActions.tsx | 8 ++++---- .../sim-management/components/SimDetailsCard.tsx | 12 ++++++------ .../sim-management/components/SimFeatureToggles.tsx | 2 +- .../components/SimManagementSection.tsx | 8 ++++---- .../subscriptions/utils/status-presenters.tsx | 2 +- .../src/features/subscriptions/views/SimCancel.tsx | 8 ++++---- .../src/features/subscriptions/views/SimReissue.tsx | 2 +- .../src/features/subscriptions/views/SimTopUp.tsx | 4 ++-- .../src/features/support/utils/case-presenters.tsx | 4 ++-- apps/portal/src/styles/utilities.css | 12 ------------ 35 files changed, 67 insertions(+), 89 deletions(-) diff --git a/apps/portal/src/app/globals.css b/apps/portal/src/app/globals.css index 470c6979..699e9a10 100644 --- a/apps/portal/src/app/globals.css +++ b/apps/portal/src/app/globals.css @@ -188,13 +188,6 @@ --color-danger-soft: var(--danger-bg); --color-neutral-soft: var(--neutral-bg); - /* Legacy aliases (existing components use these) */ - --color-destructive: var(--danger); - --color-destructive-foreground: var(--danger-foreground); - --color-destructive-soft: var(--danger-bg); - --color-error: var(--danger); - --color-error-foreground: var(--danger-foreground); - --color-border: var(--border); --color-input: var(--input); --color-ring: var(--ring); diff --git a/apps/portal/src/components/atoms/badge.tsx b/apps/portal/src/components/atoms/badge.tsx index 7fdcabd6..047087ce 100644 --- a/apps/portal/src/components/atoms/badge.tsx +++ b/apps/portal/src/components/atoms/badge.tsx @@ -11,7 +11,7 @@ const badgeVariants = cva( secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80", success: "bg-success-soft text-success hover:bg-success-soft/80", warning: "bg-warning-soft text-foreground hover:bg-warning-soft/80", - error: "bg-destructive-soft text-destructive hover:bg-destructive-soft/80", + error: "bg-danger-soft text-danger hover:bg-danger-soft/80", info: "bg-info-soft text-info hover:bg-info-soft/80", outline: "border border-border bg-background text-foreground hover:bg-muted", ghost: "text-foreground hover:bg-muted", @@ -47,7 +47,7 @@ const Badge = forwardRef( "mr-1.5 h-1.5 w-1.5 rounded-full", variant === "success" && "bg-success", variant === "warning" && "bg-warning", - variant === "error" && "bg-destructive", + variant === "error" && "bg-danger", variant === "info" && "bg-info", variant === "default" && "bg-primary-foreground", variant === "secondary" && "bg-secondary-foreground", diff --git a/apps/portal/src/components/atoms/button.tsx b/apps/portal/src/components/atoms/button.tsx index f6dc8b87..a94a04a0 100644 --- a/apps/portal/src/components/atoms/button.tsx +++ b/apps/portal/src/components/atoms/button.tsx @@ -12,7 +12,7 @@ const buttonVariants = cva( default: "bg-primary text-primary-foreground hover:bg-primary-hover shadow-[var(--cp-shadow-1)] hover:shadow-[var(--cp-shadow-2)]", destructive: - "bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-[var(--cp-shadow-1)] hover:shadow-[var(--cp-shadow-2)]", + "bg-danger text-danger-foreground hover:bg-danger/90 shadow-[var(--cp-shadow-1)] hover:shadow-[var(--cp-shadow-2)]", outline: "border border-border bg-background text-foreground hover:bg-muted shadow-[var(--cp-shadow-1)] hover:shadow-[var(--cp-shadow-2)]", secondary: diff --git a/apps/portal/src/components/atoms/checkbox.tsx b/apps/portal/src/components/atoms/checkbox.tsx index b5e1890c..bdf51aed 100644 --- a/apps/portal/src/components/atoms/checkbox.tsx +++ b/apps/portal/src/components/atoms/checkbox.tsx @@ -25,7 +25,7 @@ export const Checkbox = React.forwardRef( ref={ref} className={cn( "h-4 w-4 rounded border-input text-primary focus:ring-ring focus:ring-2", - error && "border-destructive", + error && "border-danger", className )} {...props} @@ -35,7 +35,7 @@ export const Checkbox = React.forwardRef( htmlFor={checkboxId} className={cn( "text-sm font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70", - error && "text-destructive" + error && "text-danger" )} > {label} @@ -43,7 +43,7 @@ export const Checkbox = React.forwardRef( )} {helperText && !error &&

{helperText}

} - {error &&

{error}

} + {error &&

{error}

} ); } diff --git a/apps/portal/src/components/atoms/input.tsx b/apps/portal/src/components/atoms/input.tsx index 1d88a4b5..cb92e036 100644 --- a/apps/portal/src/components/atoms/input.tsx +++ b/apps/portal/src/components/atoms/input.tsx @@ -21,7 +21,7 @@ const Input = forwardRef( "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:ring-offset-0 focus-visible:border-primary", "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:border-border", isInvalid && - "border-destructive hover:border-destructive focus-visible:ring-destructive/40 focus-visible:border-destructive", + "border-danger hover:border-danger focus-visible:ring-danger/40 focus-visible:border-danger", className )} aria-invalid={isInvalid || undefined} diff --git a/apps/portal/src/components/atoms/status-pill.tsx b/apps/portal/src/components/atoms/status-pill.tsx index 5d25ab6a..13b224e2 100644 --- a/apps/portal/src/components/atoms/status-pill.tsx +++ b/apps/portal/src/components/atoms/status-pill.tsx @@ -18,7 +18,7 @@ export const StatusPill = forwardRef( : variant === "info" ? "bg-info-soft text-info ring-info/25" : variant === "error" - ? "bg-destructive-soft text-destructive ring-destructive/25" + ? "bg-danger-soft text-danger ring-danger/25" : "bg-muted text-muted-foreground ring-border-muted/40"; const sizing = diff --git a/apps/portal/src/components/molecules/AlertBanner/AlertBanner.tsx b/apps/portal/src/components/molecules/AlertBanner/AlertBanner.tsx index e6e20724..0aa2125e 100644 --- a/apps/portal/src/components/molecules/AlertBanner/AlertBanner.tsx +++ b/apps/portal/src/components/molecules/AlertBanner/AlertBanner.tsx @@ -37,10 +37,10 @@ const variantClasses: Record< Icon: ExclamationTriangleIcon, }, error: { - bg: "bg-destructive-soft", - border: "border-destructive/30", - text: "text-destructive", - icon: "text-destructive", + bg: "bg-danger-soft", + border: "border-danger/30", + text: "text-danger", + icon: "text-danger", Icon: XCircleIcon, }, }; diff --git a/apps/portal/src/components/molecules/FormField/FormField.tsx b/apps/portal/src/components/molecules/FormField/FormField.tsx index 5fc164d8..97bb1695 100644 --- a/apps/portal/src/components/molecules/FormField/FormField.tsx +++ b/apps/portal/src/components/molecules/FormField/FormField.tsx @@ -49,14 +49,14 @@ const FormField = forwardRef( htmlFor={id} className={cn( "block text-sm font-medium text-muted-foreground", - error && "text-destructive", + error && "text-danger", labelProps?.className )} {...(labelProps ? { ...labelProps, className: undefined } : undefined)} > {label} {required ? ( -