From 903e392e9a7b6902ade120f8be319836b01723d5 Mon Sep 17 00:00:00 2001 From: "Nguyen, Tom CITZ:EX" Date: Mon, 7 Oct 2024 20:34:31 -0700 Subject: [PATCH] chore: rename ButtonWithIcon to IconButton Signed-off-by: Nguyen, Tom CITZ:EX --- .../core/App/components/buttons/HeaderHome.tsx | 4 ++-- .../buttons/{ButtonWithIcon.tsx => IconButton.tsx} | 6 +++--- .../legacy/core/App/components/buttons/InfoIcon.tsx | 4 ++-- .../core/App/components/buttons/SettingsMenu.tsx | 4 ++-- .../legacy/core/App/components/misc/NewQRView.tsx | 8 ++++---- packages/legacy/core/App/index.ts | 4 ++-- .../modules/history/ui/components/HistoryMenu.tsx | 4 ++-- .../legacy/core/App/navigators/ProofRequestStack.tsx | 6 +++--- packages/legacy/core/App/navigators/RootStack.tsx | 4 ++-- packages/legacy/core/App/screens/ListContacts.tsx | 4 ++-- packages/legacy/core/App/screens/Onboarding.tsx | 4 ++-- packages/legacy/core/App/screens/ProofRequesting.tsx | 4 ++-- packages/legacy/core/App/screens/Settings.tsx | 4 ++-- .../{ButtonWithIcon.test.tsx => IconButton.test.tsx} | 12 ++++++------ ...thIcon.test.tsx.snap => IconButton.test.tsx.snap} | 6 +++--- 15 files changed, 39 insertions(+), 39 deletions(-) rename packages/legacy/core/App/components/buttons/{ButtonWithIcon.tsx => IconButton.tsx} (94%) rename packages/legacy/core/__tests__/components/{ButtonWithIcon.test.tsx => IconButton.test.tsx} (87%) rename packages/legacy/core/__tests__/components/__snapshots__/{ButtonWithIcon.test.tsx.snap => IconButton.test.tsx.snap} (95%) diff --git a/packages/legacy/core/App/components/buttons/HeaderHome.tsx b/packages/legacy/core/App/components/buttons/HeaderHome.tsx index ac646be2b..166ea7e91 100644 --- a/packages/legacy/core/App/components/buttons/HeaderHome.tsx +++ b/packages/legacy/core/App/components/buttons/HeaderHome.tsx @@ -5,14 +5,14 @@ import { useTranslation } from 'react-i18next' import { Screens, TabStacks } from '../../types/navigators' import { testIdWithKey } from '../../utils/testable' -import ButtonWithIcon, { ButtonLocation } from './ButtonWithIcon' +import IconButton, { ButtonLocation } from './IconButton' const HeaderRightHome: React.FC = () => { const { t } = useTranslation() const navigation = useNavigation() return ( - = ({ +const IconButton: React.FC = ({ buttonLocation, icon, text, @@ -83,4 +83,4 @@ const ButtonWithIcon: React.FC = ({ ) } -export default ButtonWithIcon +export default IconButton diff --git a/packages/legacy/core/App/components/buttons/InfoIcon.tsx b/packages/legacy/core/App/components/buttons/InfoIcon.tsx index 750e3c8bc..953597189 100644 --- a/packages/legacy/core/App/components/buttons/InfoIcon.tsx +++ b/packages/legacy/core/App/components/buttons/InfoIcon.tsx @@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next' import { RootStackParams, Screens, Stacks } from '../../types/navigators' import { testIdWithKey } from '../../utils/testable' -import ButtonWithIcon, { ButtonLocation } from './ButtonWithIcon' +import IconButton, { ButtonLocation } from './IconButton' interface InfoIconProps { connectionId: string @@ -17,7 +17,7 @@ const InfoIcon: React.FC = ({ connectionId }) => { const { t } = useTranslation() return ( - { const navigation = useNavigation>() const { t } = useTranslation() return ( - = ({ defaultToConnect, handleCodeScan, error, e useEffect(() => { let headerRight = invitation ? ( - = ({ defaultToConnect, handleCodeScan, error, e if (firstTabActive) { headerRight = ( - = ({ defaultToConnect, handleCodeScan, error, e {store.preferences.walletName} - { const { t } = useTranslation() return ( - { options={({ navigation }) => ({ title: t('ProofRequest.RequestForProof'), headerLeft: () => ( - { options={({ navigation, route }) => ({ title: '', headerLeft: () => ( - { headerShown: true, title: t('Screens.CredentialOffer'), headerLeft: () => ( - = ({ navigation }) => { if (store.preferences.useConnectionInviterCapability) { navigation.setOptions({ headerRight: () => ( - = ({ !disableSkip && navigation.setOptions({ headerRight: () => ( - = ({ route, navigation }) useEffect(() => { if (message && store.preferences.enableShareableLink) { const scanShareUrl = () => ( - = ({ navigation }) => { {iconRight && ( - { +describe('IconButton Component', () => { test('Left alignment renders correctly', () => { const tree = render( - { test('Right alignment renders correctly', () => { const tree = render( - { test('Right alignment with text renders correctly', () => { const tree = render( - { test('Button onPress triggers on press', () => { const callback = jest.fn() const { getByTestId } = render( - `; -exports[`ButtonWithIcon Component Right alignment renders correctly 1`] = ` +exports[`IconButton Component Right alignment renders correctly 1`] = ` `; -exports[`ButtonWithIcon Component Right alignment with text renders correctly 1`] = ` +exports[`IconButton Component Right alignment with text renders correctly 1`] = `