From 72b31e54b6eefbad9af725041b80427b19fa2d7b Mon Sep 17 00:00:00 2001 From: Thisyahlen Date: Tue, 20 Feb 2024 15:01:58 +0800 Subject: [PATCH 1/3] chore: replace clsx with tailwind-merge --- packages/tradershub/package.json | 1 + .../src/components/ActionScreen/ActionScreen.tsx | 6 ++++-- .../src/components/AppContainer/AppContainer.tsx | 4 ++-- .../src/components/ButtonGroup/ButtonGroup.tsx | 4 ++-- .../components/CFDSection/CFDHeading/CFDHeading.tsx | 4 ++-- .../components/DemoRealSwitcher/DemoRealSwitcher.tsx | 10 +++++----- packages/tradershub/src/components/Dialog/Dialog.tsx | 4 ++-- .../tradershub/src/components/Dialog/DialogAction.tsx | 4 ++-- .../tradershub/src/components/Dialog/DialogHeader.tsx | 4 ++-- packages/tradershub/src/components/Modal/Modal.tsx | 4 ++-- .../tradershub/src/components/Modal/ModalContent.tsx | 4 ++-- .../tradershub/src/components/Modal/ModalFooter.tsx | 4 ++-- .../tradershub/src/components/Modal/ModalHeader.tsx | 6 +++--- .../src/components/ProgressBar/StepConnector.tsx | 4 ++-- .../tradershub/src/components/ProgressBar/Stepper.tsx | 4 ++-- .../src/components/StaticLink/StaticLink.tsx | 4 ++-- packages/tradershub/src/components/Tooltip/Tooltip.tsx | 6 +++--- .../src/components/TotalAssets/TotalAssets.tsx | 4 ++-- .../TradingAccountsList/TradingAccountsList.tsx | 4 ++-- .../CompareAccountsCarouselButton.tsx | 4 ++-- .../CompareAccountsPlatformLabel.tsx | 8 ++++---- .../CFDCompareAccounts/InstrumentsLabelHighlighted.tsx | 4 ++-- .../screens/DynamicLeverage/DynamicLeverageScreen.tsx | 4 ++-- .../Jurisdiction/JurisdictionCard/JurisdictionCard.tsx | 4 ++-- .../cfd/screens/Jurisdiction/JurisdictionScreen.tsx | 4 ++-- .../screens/MT5AccountTypeCard/MT5AccountTypeCard.tsx | 4 ++-- .../TradeScreen/TradeDetailsItem/TradeDetailsItem.tsx | 4 ++-- .../AccountOpeningSuccessModal.tsx | 6 +++--- packages/tradershub/src/modals/RegulationModal/Row.tsx | 4 ++-- .../SignupWizardProvider/SignupWizardContext.tsx | 2 +- .../src/screens/CurrencySelector/Currencies.tsx | 8 ++------ .../src/screens/CurrencySelector/CurrencyCard.tsx | 4 ++-- .../src/screens/PersonalDetails/Sections/Details.tsx | 4 +--- 33 files changed, 73 insertions(+), 76 deletions(-) diff --git a/packages/tradershub/package.json b/packages/tradershub/package.json index e603af77a5ed..9a1b7f8cf4eb 100644 --- a/packages/tradershub/package.json +++ b/packages/tradershub/package.json @@ -38,6 +38,7 @@ "react-i18next": "^11.11.0", "react-router-dom": "^5.2.0", "react-transition-group": "4.4.2", + "tailwind-merge": "^1.14.0", "usehooks-ts": "^2.7.0", "yup": "^0.32.11" }, diff --git a/packages/tradershub/src/components/ActionScreen/ActionScreen.tsx b/packages/tradershub/src/components/ActionScreen/ActionScreen.tsx index fae375e7275f..2b063771162f 100644 --- a/packages/tradershub/src/components/ActionScreen/ActionScreen.tsx +++ b/packages/tradershub/src/components/ActionScreen/ActionScreen.tsx @@ -1,5 +1,5 @@ import React, { ComponentProps, isValidElement, ReactNode } from 'react'; -import { clsx } from 'clsx'; +import { twMerge } from 'tailwind-merge'; import { Text } from '@deriv-com/ui'; type TActionScreenProps = { @@ -29,7 +29,9 @@ const ActionScreen = ({ titleSize = 'md', }: TActionScreenProps) => { return ( -
+
{icon}
{title && ( diff --git a/packages/tradershub/src/components/AppContainer/AppContainer.tsx b/packages/tradershub/src/components/AppContainer/AppContainer.tsx index 147bcff25bec..e4c3c5539476 100644 --- a/packages/tradershub/src/components/AppContainer/AppContainer.tsx +++ b/packages/tradershub/src/components/AppContainer/AppContainer.tsx @@ -1,5 +1,5 @@ import React, { ReactNode } from 'react'; -import { clsx } from 'clsx'; +import { twMerge } from 'tailwind-merge'; type TAppContainerProps = { children: ReactNode; @@ -13,7 +13,7 @@ type TAppContainerProps = { */ const AppContainer = ({ children, className }: TAppContainerProps) => ( -
+
{children}
); diff --git a/packages/tradershub/src/components/ButtonGroup/ButtonGroup.tsx b/packages/tradershub/src/components/ButtonGroup/ButtonGroup.tsx index 799b669c3f34..289679ed65c7 100644 --- a/packages/tradershub/src/components/ButtonGroup/ButtonGroup.tsx +++ b/packages/tradershub/src/components/ButtonGroup/ButtonGroup.tsx @@ -1,5 +1,5 @@ import React, { FC, PropsWithChildren } from 'react'; -import { clsx } from 'clsx'; +import { twMerge } from 'tailwind-merge'; type TButtonGroupProps = { className?: string }; @@ -13,7 +13,7 @@ type TButtonGroupProps = { className?: string }; */ const ButtonGroup: FC> = ({ children, className }) => ( -
{children}
+
{children}
); export default ButtonGroup; diff --git a/packages/tradershub/src/components/CFDSection/CFDHeading/CFDHeading.tsx b/packages/tradershub/src/components/CFDSection/CFDHeading/CFDHeading.tsx index 4907175219d5..d2b27bd2b147 100644 --- a/packages/tradershub/src/components/CFDSection/CFDHeading/CFDHeading.tsx +++ b/packages/tradershub/src/components/CFDSection/CFDHeading/CFDHeading.tsx @@ -1,6 +1,6 @@ import React, { Fragment } from 'react'; -import { clsx } from 'clsx'; import { useHistory } from 'react-router-dom'; +import { twMerge } from 'tailwind-merge'; import { StaticLink, TitleDescriptionLoader } from '@/components'; import { useRegulationFlags } from '@/hooks'; import { useIsEuRegion } from '@deriv/api'; @@ -15,7 +15,7 @@ const CompareAccountsButton = ({ className }: { className?: string }) => { return ( - diff --git a/packages/tradershub/src/modals/RegulationModal/Row.tsx b/packages/tradershub/src/modals/RegulationModal/Row.tsx index ccfbd7a12524..157b8884e7a9 100644 --- a/packages/tradershub/src/modals/RegulationModal/Row.tsx +++ b/packages/tradershub/src/modals/RegulationModal/Row.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { clsx } from 'clsx'; +import { twMerge } from 'tailwind-merge'; import { Text } from '@deriv-com/ui'; import { TRegulatorsContentProps, TRowItem } from '../../constants/regulators-modal-content'; @@ -8,7 +8,7 @@ type TRowProps = TRegulatorsContentProps & { }; const Row = ({ attribute, content, id, idx }: TRowProps) => ( - + { * @param {React.ReactNode} children - The content to be wrapped. */ export const SignupWizardProvider = ({ children }: TSignupWizardProvider) => { - const [isWizardOpen, setIsWizardOpen] = useState(false); + const [isWizardOpen, setIsWizardOpen] = useState(true); const [isSuccessModalOpen, setIsSuccessModalOpen] = useState(false); const [currentStep, helpers] = useStep(4); const [state, dispatch] = useReducer(valuesReducer, { diff --git a/packages/tradershub/src/screens/CurrencySelector/Currencies.tsx b/packages/tradershub/src/screens/CurrencySelector/Currencies.tsx index 734d46897fcc..25b8e4b2bab5 100644 --- a/packages/tradershub/src/screens/CurrencySelector/Currencies.tsx +++ b/packages/tradershub/src/screens/CurrencySelector/Currencies.tsx @@ -1,5 +1,5 @@ import React, { useMemo } from 'react'; -import clsx from 'clsx'; +import { twMerge } from 'tailwind-merge'; import { InlineMessage, Text } from '@deriv-com/ui'; import { CURRENCY_TYPES, getCurrencyConfig } from '../../helpers/currencyConfig'; import CurrencyCard from './CurrencyCard'; @@ -29,11 +29,7 @@ const Currencies = ({ type }: TCurrencies) => { Please note that you can only have 1 fiat account. )} -
+
{currencies.map(currency => ( ))} diff --git a/packages/tradershub/src/screens/CurrencySelector/CurrencyCard.tsx b/packages/tradershub/src/screens/CurrencySelector/CurrencyCard.tsx index 0d5aac2c0347..b62f64102752 100644 --- a/packages/tradershub/src/screens/CurrencySelector/CurrencyCard.tsx +++ b/packages/tradershub/src/screens/CurrencySelector/CurrencyCard.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { clsx } from 'clsx'; import { useFormikContext } from 'formik'; +import { twMerge } from 'tailwind-merge'; import { StandaloneCircleInfoRegularIcon as CircleInfoIcon } from '@deriv/quill-icons'; import { Text } from '@deriv-com/ui'; import { getCurrencyConfig } from '../../helpers/currencyConfig'; @@ -24,7 +24,7 @@ const CurrencyCard = ({ icon: Icon, id, info, title }: TCurrencyCard) => { return (
-
- -
+
{/* */}
); From f45dc5c590085bcff7fcf9ec3a8305eec8e8ce07 Mon Sep 17 00:00:00 2001 From: Thisyahlen Date: Tue, 20 Feb 2024 15:15:30 +0800 Subject: [PATCH 2/3] chore: unkomen --- .../src/screens/PersonalDetails/Sections/Details.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/tradershub/src/screens/PersonalDetails/Sections/Details.tsx b/packages/tradershub/src/screens/PersonalDetails/Sections/Details.tsx index a2d0a7d67838..018bfdc8ea5d 100644 --- a/packages/tradershub/src/screens/PersonalDetails/Sections/Details.tsx +++ b/packages/tradershub/src/screens/PersonalDetails/Sections/Details.tsx @@ -91,7 +91,9 @@ const Details = () => {
-
{/* */}
+
+ +
); From 849431acf375cbfa6367398e08e0e2ff459af6a6 Mon Sep 17 00:00:00 2001 From: Thisyahlen Date: Tue, 20 Feb 2024 15:21:33 +0800 Subject: [PATCH 3/3] chore: untrue --- .../src/providers/SignupWizardProvider/SignupWizardContext.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tradershub/src/providers/SignupWizardProvider/SignupWizardContext.tsx b/packages/tradershub/src/providers/SignupWizardProvider/SignupWizardContext.tsx index 67170035c68b..8995192f7e8f 100644 --- a/packages/tradershub/src/providers/SignupWizardProvider/SignupWizardContext.tsx +++ b/packages/tradershub/src/providers/SignupWizardProvider/SignupWizardContext.tsx @@ -60,7 +60,7 @@ export const useSignupWizardContext = () => { * @param {React.ReactNode} children - The content to be wrapped. */ export const SignupWizardProvider = ({ children }: TSignupWizardProvider) => { - const [isWizardOpen, setIsWizardOpen] = useState(true); + const [isWizardOpen, setIsWizardOpen] = useState(false); const [isSuccessModalOpen, setIsSuccessModalOpen] = useState(false); const [currentStep, helpers] = useStep(4); const [state, dispatch] = useReducer(valuesReducer, {