From 5bc3860f211c74dd198ccc5a031559aac9200c31 Mon Sep 17 00:00:00 2001 From: Arshpreet Singh <73437174+GoldGroove06@users.noreply.github.com.> Date: Wed, 11 Dec 2024 13:02:58 +0530 Subject: [PATCH] Util classname 3 --- src/components/ui/Separator/Separator.tsx | 4 ++-- src/components/ui/Skeleton/Skeleton.tsx | 4 ++-- src/components/ui/Strong/Strong.tsx | 4 ++-- src/components/ui/Switch/Switch.tsx | 3 ++- src/components/ui/Table/fragments/TableBody.tsx | 3 ++- src/components/ui/Table/fragments/TableCell.tsx | 3 ++- src/components/ui/Table/fragments/TableColumnCellHeader.tsx | 3 ++- src/components/ui/Table/fragments/TableHead.tsx | 3 ++- src/components/ui/Table/fragments/TableRoot.tsx | 6 +++--- src/components/ui/Table/fragments/TableRow.tsx | 3 ++- src/components/ui/Tabs/fragments/TabContent.tsx | 3 ++- src/components/ui/Tabs/fragments/TabList.tsx | 4 ++-- src/components/ui/Tabs/fragments/TabRoot.tsx | 4 ++-- src/components/ui/Tabs/fragments/TabTrigger.tsx | 4 ++-- src/components/ui/Text/Text.tsx | 5 +++-- src/components/ui/TextArea/TextArea.tsx | 4 ++-- src/components/ui/TextArea/fragments/TextAreaRoot.tsx | 3 ++- src/components/ui/Toggle/Toggle.tsx | 4 ++-- src/components/ui/ToggleGroup/fragments/ToggleGroupRoot.tsx | 4 ++-- src/components/ui/Tree/fragments/TreeItem.tsx | 3 ++- 20 files changed, 42 insertions(+), 32 deletions(-) diff --git a/src/components/ui/Separator/Separator.tsx b/src/components/ui/Separator/Separator.tsx index dea62a6b..7b75e11e 100644 --- a/src/components/ui/Separator/Separator.tsx +++ b/src/components/ui/Separator/Separator.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { customClassSwitcher } from '~/core'; - +import { clsx } from 'clsx'; const COMPONENT_NAME = 'Separator'; export type SeparatorProps = { @@ -14,7 +14,7 @@ const Separator = ({ orientation = 'horizontal', className, customRootClass, ... const rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME); const orientationClass = orientation === 'vertical' ? `${rootClass}-vertical` : `${rootClass}-horizontal`; - return
; + return
; }; Separator.displayName = COMPONENT_NAME; diff --git a/src/components/ui/Skeleton/Skeleton.tsx b/src/components/ui/Skeleton/Skeleton.tsx index 4a9a2f72..a880a2b2 100644 --- a/src/components/ui/Skeleton/Skeleton.tsx +++ b/src/components/ui/Skeleton/Skeleton.tsx @@ -1,7 +1,7 @@ 'use client'; import React from 'react'; import { customClassSwitcher } from '~/core'; - +import { clsx } from 'clsx'; const COMPONENT_NAME = 'Skeleton'; const Skeleton = ({ loading = true, className = '', customRootClass = '', children, ...props }:any) => { @@ -9,7 +9,7 @@ const Skeleton = ({ loading = true, className = '', customRootClass = '', childr if (!loading) return children; const rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME); - return + return {children} ; }; diff --git a/src/components/ui/Strong/Strong.tsx b/src/components/ui/Strong/Strong.tsx index 6089eb0b..983b3faa 100644 --- a/src/components/ui/Strong/Strong.tsx +++ b/src/components/ui/Strong/Strong.tsx @@ -1,5 +1,5 @@ import React from 'react'; - +import { clsx } from 'clsx'; import { customClassSwitcher } from '~/core'; const COMPONENT_NAME = 'Strong'; @@ -12,7 +12,7 @@ export type StrongProps = { const Strong = ({ children, className, customRootClass, ...props }: StrongProps) => { const rootClass = customClassSwitcher(customRootClass, COMPONENT_NAME); return ( - {children} + {children} ); }; diff --git a/src/components/ui/Switch/Switch.tsx b/src/components/ui/Switch/Switch.tsx index 5d7d10c8..059c6547 100644 --- a/src/components/ui/Switch/Switch.tsx +++ b/src/components/ui/Switch/Switch.tsx @@ -1,6 +1,7 @@ 'use client'; import React, { useState } from 'react'; import { customClassSwitcher } from '~/core'; +import { clsx } from 'clsx'; const COMPONENT_NAME = 'Switch'; export type SwitchProps = { @@ -26,7 +27,7 @@ const Switch = ({ children, customRootClass = '', className = '', color = '', de }; return ( <> - + ); diff --git a/src/components/ui/Table/fragments/TableBody.tsx b/src/components/ui/Table/fragments/TableBody.tsx index 5c41648d..034fdcfd 100644 --- a/src/components/ui/Table/fragments/TableBody.tsx +++ b/src/components/ui/Table/fragments/TableBody.tsx @@ -1,7 +1,8 @@ import React from 'react'; +import { clsx } from 'clsx'; const TableBody = ({ children, className = '', ...props }:any) => { - return + return {children} ; }; diff --git a/src/components/ui/Table/fragments/TableCell.tsx b/src/components/ui/Table/fragments/TableCell.tsx index c7d7cd31..8da94437 100644 --- a/src/components/ui/Table/fragments/TableCell.tsx +++ b/src/components/ui/Table/fragments/TableCell.tsx @@ -1,7 +1,8 @@ import React from 'react'; +import { clsx } from 'clsx'; const TableCell = ({ children, className = 'cell', ...props }:any) => { - return + return {children} ; }; diff --git a/src/components/ui/Table/fragments/TableColumnCellHeader.tsx b/src/components/ui/Table/fragments/TableColumnCellHeader.tsx index 3e218d5a..ca066443 100644 --- a/src/components/ui/Table/fragments/TableColumnCellHeader.tsx +++ b/src/components/ui/Table/fragments/TableColumnCellHeader.tsx @@ -1,7 +1,8 @@ import React from 'react'; +import { clsx } from 'clsx'; const TableColumnCellHeader = ({ children, className = 'cell-header', ...props }:any) => { - return + return {children} ; }; diff --git a/src/components/ui/Table/fragments/TableHead.tsx b/src/components/ui/Table/fragments/TableHead.tsx index c2f5ae21..5f21dab0 100644 --- a/src/components/ui/Table/fragments/TableHead.tsx +++ b/src/components/ui/Table/fragments/TableHead.tsx @@ -1,7 +1,8 @@ import React from 'react'; +import { clsx } from 'clsx'; const TableHead = ({ children, className = 'header', ...props }:any) => { - return + return {children} ; }; diff --git a/src/components/ui/Table/fragments/TableRoot.tsx b/src/components/ui/Table/fragments/TableRoot.tsx index 13624cd4..722c22af 100644 --- a/src/components/ui/Table/fragments/TableRoot.tsx +++ b/src/components/ui/Table/fragments/TableRoot.tsx @@ -1,5 +1,5 @@ import React from 'react'; - +import { clsx } from 'clsx'; import { customClassSwitcher } from '~/core'; const COMPONENT_NAME = 'Table'; @@ -11,9 +11,9 @@ const TableRoot = ({ children, className = '', customRootClass = '', ...props }: // so we created a new class for element as a one off case in pattern when it comes to naming classes/conventions // this is because we cant style the table element directly, so we'll need to wrap it in a div and style it instead - return
+ return
{/* Todo: need to break this down into its own wrapper component */} -
+
{children}
; diff --git a/src/components/ui/Table/fragments/TableRow.tsx b/src/components/ui/Table/fragments/TableRow.tsx index 2d25911b..a113b191 100644 --- a/src/components/ui/Table/fragments/TableRow.tsx +++ b/src/components/ui/Table/fragments/TableRow.tsx @@ -1,7 +1,8 @@ import React from 'react'; +import { clsx } from 'clsx'; const TableRow = ({ children, className = 'row', ...props }:any) => { - return + return {children} ; }; diff --git a/src/components/ui/Tabs/fragments/TabContent.tsx b/src/components/ui/Tabs/fragments/TabContent.tsx index d1f40e33..5891983e 100644 --- a/src/components/ui/Tabs/fragments/TabContent.tsx +++ b/src/components/ui/Tabs/fragments/TabContent.tsx @@ -3,6 +3,7 @@ import React, { useContext } from 'react'; import { customClassSwitcher } from '~/core'; import { TabProps } from '../types'; import TabsRootContext from '../context/TabsRootContext'; +import { clsx } from 'clsx'; const COMPONENT_NAME = 'TabContent'; export type TabContentProps ={ @@ -17,7 +18,7 @@ const TabContent = ({ className, customRootClass }: TabContentProps) => { const { tabs, activeTab, setActiveTab } = useContext(TabsRootContext); - return
+ return
{tabs.map((tab, index) => { if (tab.value === activeTab) { return
{tab.content}
; diff --git a/src/components/ui/Tabs/fragments/TabList.tsx b/src/components/ui/Tabs/fragments/TabList.tsx index 6aeca48f..bd37118a 100644 --- a/src/components/ui/Tabs/fragments/TabList.tsx +++ b/src/components/ui/Tabs/fragments/TabList.tsx @@ -1,6 +1,6 @@ 'use client'; import React, { useContext } from 'react'; - +import { clsx } from 'clsx'; import TabTrigger from './TabTrigger'; import { TabProps } from '../types'; import TabsRootContext from '../context/TabsRootContext'; @@ -17,7 +17,7 @@ export type TabListProps = { const TabList = ({ className = '', children }: TabListProps) => { const { rootClass } = useContext(TabsRootContext); - return
+ return
{children}
; }; diff --git a/src/components/ui/Tabs/fragments/TabRoot.tsx b/src/components/ui/Tabs/fragments/TabRoot.tsx index 721c4d84..8cc1eee3 100644 --- a/src/components/ui/Tabs/fragments/TabRoot.tsx +++ b/src/components/ui/Tabs/fragments/TabRoot.tsx @@ -1,7 +1,7 @@ 'use client'; import React, { useState, useRef } from 'react'; import { customClassSwitcher } from '~/core'; - +import { clsx } from 'clsx'; import TabsRootContext from '../context/TabsRootContext'; import { getAllBatchElements, getNextBatchItem, getPrevBatchItem } from '~/core/batches'; @@ -38,7 +38,7 @@ const TabRoot = ({ children, defaultTab = '', customRootClass, tabs = [], classN return ( -
+
{children}
diff --git a/src/components/ui/Tabs/fragments/TabTrigger.tsx b/src/components/ui/Tabs/fragments/TabTrigger.tsx index 5f481930..a8c70e3e 100644 --- a/src/components/ui/Tabs/fragments/TabTrigger.tsx +++ b/src/components/ui/Tabs/fragments/TabTrigger.tsx @@ -1,6 +1,6 @@ 'use client'; import React, { useContext, useRef } from 'react'; - +import { clsx } from 'clsx'; import { TabProps } from '../types'; import TabsRootContext from '../context/TabsRootContext'; @@ -49,7 +49,7 @@ const TabTrigger = ({ tab, className = '', ...props }: TabTriggerProps) => { return (