From 99534a07681e782dd29c0a02351f47a85c477174 Mon Sep 17 00:00:00 2001 From: Kelly Phan Date: Tue, 24 Dec 2024 10:07:22 +0100 Subject: [PATCH] refactor: migrate styled-components usage of form components (#1928) * feat: add reset style in text input props for charge table * refactor: migrate TextInput styled components * refactor: migrate AmountInput styled components * refactor: migrate Checkbox styled components * refactor: migrate Combobox styled components * refactor: rename resetStyle with variant outlined * fix: remove sx text input * fix: prettier --- src/components/SearchInput.tsx | 16 +---- .../creditNote/CreditNoteFormCalculation.tsx | 14 ++-- .../form/ComboBox/ComboBoxInput.tsx | 21 +++--- .../MultipleComboBox/MultipleComboBox.tsx | 8 ++- src/components/form/TextInput/TextInput.tsx | 28 ++++++++ .../form/TextInput/TextInputField.tsx | 14 +--- .../invoices/EditInvoiceDisplayName.tsx | 9 +-- .../EditInvoiceItemDescriptionDialog.tsx | 12 +--- .../EditInvoicePaymentStatusDialog.tsx | 9 +-- src/components/plans/ChargeAccordion.tsx | 7 +- src/components/plans/ChargePercentage.tsx | 26 ++++--- src/components/plans/FixedFeeSection.tsx | 7 +- src/components/plans/GraduatedChargeTable.tsx | 59 ++-------------- .../plans/GraduatedPercentageChargeTable.tsx | 59 ++-------------- src/components/plans/PlanSettingsSection.tsx | 8 +-- .../plans/ProgressiveBillingSection.tsx | 68 +++---------------- src/components/plans/StandardCharge.tsx | 10 +-- src/components/plans/VolumeChargeTable.tsx | 59 ++-------------- .../EditOrganizationInvoiceTemplateDialog.tsx | 9 +-- src/pages/Analytics.tsx | 17 +---- src/pages/CreateAddOn.tsx | 8 +-- src/pages/CreateCoupon.tsx | 15 ++-- src/pages/CreateInvoice.tsx | 8 +-- src/pages/auth/ForgotPassword.tsx | 9 +-- src/pages/auth/ResetPassword.tsx | 9 +-- tailwind.config.ts | 1 + 26 files changed, 121 insertions(+), 389 deletions(-) diff --git a/src/components/SearchInput.tsx b/src/components/SearchInput.tsx index f9564c9a6..8b1d9708f 100644 --- a/src/components/SearchInput.tsx +++ b/src/components/SearchInput.tsx @@ -1,8 +1,7 @@ import { useState } from 'react' -import styled from 'styled-components' import { UseDebouncedSearch } from '~/hooks/useDebouncedSearch' -import { theme } from '~/styles' +import { tw } from '~/styles/utils' import { Icon } from './designSystem' import { TextInput } from './form' @@ -17,8 +16,8 @@ export const SearchInput = ({ className, onChange, placeholder }: SearchInputPro const [localValue, setLocalValue] = useState('') return ( - { @@ -32,12 +31,3 @@ export const SearchInput = ({ className, onChange, placeholder }: SearchInputPro /> ) } - -const TextInputForSearch = styled(TextInput)` - max-width: 240px; - - .MuiInputBase-inputAdornedStart { - height: 40px; - padding-left: ${theme.spacing(3)}; - } -` diff --git a/src/components/creditNote/CreditNoteFormCalculation.tsx b/src/components/creditNote/CreditNoteFormCalculation.tsx index 4146e142f..b133f158d 100644 --- a/src/components/creditNote/CreditNoteFormCalculation.tsx +++ b/src/components/creditNote/CreditNoteFormCalculation.tsx @@ -410,7 +410,8 @@ export const CreditNoteFormCalculation = ({ _get(formikProps.errors, 'payBack.0.value') !== PayBackErrorEnum.maxRefund } > - - { // needed because useAutocomplete expect a DOM onChange listener... inputProps.onChange({ target: { value: newVal } }) searchQuery && searchQuery(newVal) }} - className={className} + className={tw('group/combobox-input', className)} name={name} placeholder={placeholder} label={label} @@ -56,9 +56,12 @@ export const ComboBoxInput = ({ {!disableClearable && (