From d4efa9326d2fc61b242a9894d461fe60fb3c793d Mon Sep 17 00:00:00 2001 From: rufus emmanuel <111886159+Bitcex@users.noreply.github.com> Date: Thu, 19 Dec 2024 03:42:09 +0100 Subject: [PATCH] Refactor clsx handling in Button component for improved readability and flexibility This commit refines the clsx handling in the Button component by simplifying the logic for conditional class assignment. Previously, the className prop was being assigned using the nullish coalescing operator (??), which could be simplified by directly utilizing clsx for combining default classes with the custom className provided. Changes made: - Replaced the ?? operator with direct usage of clsx to concatenate default classes with the custom className in a more readable and concise manner. - Ensured that clsx effectively handles undefined or null values for className, reducing the need for explicit checks. The refactor improves readability, reduces unnecessary checks, and ensures that the Button component continues to function as expected with the correct class names being applied. This change does not affect the functionality or appearance of the component but enhances code clarity, making it easier to manage and extend the class names in the future. --- libs/base-ui/Button/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/base-ui/Button/index.tsx b/libs/base-ui/Button/index.tsx index 05186352e8..3f192d3693 100644 --- a/libs/base-ui/Button/index.tsx +++ b/libs/base-ui/Button/index.tsx @@ -18,9 +18,9 @@ function Button({ onClick, disabled, children, className, variant = 'primary' }: