From 8934dacb3e7a8bb8bc80fc40e3baf61509c061e5 Mon Sep 17 00:00:00 2001 From: Farrah Mae Ochoa Date: Tue, 23 Apr 2024 19:33:18 +0400 Subject: [PATCH] fix: remove closeheader component --- src/components/CloseHeader/CloseHeader.scss | 26 --------------- src/components/CloseHeader/CloseHeader.tsx | 23 ------------- .../__tests__/CloseHeader.spec.tsx | 32 ------------------- src/components/CloseHeader/index.ts | 1 - src/components/index.ts | 1 - src/routes/AppContent/index.tsx | 2 -- 6 files changed, 85 deletions(-) delete mode 100644 src/components/CloseHeader/CloseHeader.scss delete mode 100644 src/components/CloseHeader/CloseHeader.tsx delete mode 100644 src/components/CloseHeader/__tests__/CloseHeader.spec.tsx delete mode 100644 src/components/CloseHeader/index.ts diff --git a/src/components/CloseHeader/CloseHeader.scss b/src/components/CloseHeader/CloseHeader.scss deleted file mode 100644 index cf845b4a..00000000 --- a/src/components/CloseHeader/CloseHeader.scss +++ /dev/null @@ -1,26 +0,0 @@ -.close-header { - width: 100%; - height: 4rem; - display: flex; - justify-content: center; - align-items: center; - font-size: 1.6rem; - font-weight: 800; - border-bottom: 2px solid #f2f3f4; - padding: 2.4rem; - margin-bottom: 2.4rem; - - @include mobile { - padding: 0.8rem 2.4rem; - margin-bottom: 0; - } - - &--icon { - position: absolute; - right: 2rem; - cursor: pointer; - border: none; - background-color: inherit; - font-weight: 800; - } -} diff --git a/src/components/CloseHeader/CloseHeader.tsx b/src/components/CloseHeader/CloseHeader.tsx deleted file mode 100644 index 69108c09..00000000 --- a/src/components/CloseHeader/CloseHeader.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { useDevice } from '@/hooks/custom-hooks'; -import { LabelPairedXmarkLgBoldIcon } from '@deriv/quill-icons'; -import { Text } from '@deriv-com/ui'; -import './CloseHeader.scss'; - -const CloseHeader = () => { - const { isMobile } = useDevice(); - - return ( -
- - {isMobile ? 'Deriv P2P' : 'Cashier'} - - window.history.back()} - /> -
- ); -}; - -export default CloseHeader; diff --git a/src/components/CloseHeader/__tests__/CloseHeader.spec.tsx b/src/components/CloseHeader/__tests__/CloseHeader.spec.tsx deleted file mode 100644 index 5e706cbf..00000000 --- a/src/components/CloseHeader/__tests__/CloseHeader.spec.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { render, screen } from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; -import CloseHeader from '../CloseHeader'; - -const mockUseDevice = { - isMobile: false, -}; - -jest.mock('@/hooks/useDevice', () => ({ - __esModule: true, - default: jest.fn(() => mockUseDevice), -})); -let windowHistoryBackSpy: jest.SpyInstance; - -describe('CloseHeader', () => { - it('should navigate back when cross icon is clicked', async () => { - windowHistoryBackSpy = jest.spyOn(window.history, 'back'); - render(); - const crossIcon = screen.getByTestId('dt_close_header_close_icon'); - await userEvent.click(crossIcon); - expect(windowHistoryBackSpy).toBeCalled(); - }); - it('should render the correct header title on desktop', () => { - render(); - expect(screen.getByText('Cashier')).toBeInTheDocument(); - }); - it('should render the correct header title on mobile', () => { - mockUseDevice.isMobile = true; - render(); - expect(screen.getByText('Deriv P2P')).toBeInTheDocument(); - }); -}); diff --git a/src/components/CloseHeader/index.ts b/src/components/CloseHeader/index.ts deleted file mode 100644 index 50383680..00000000 --- a/src/components/CloseHeader/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default as CloseHeader } from './CloseHeader'; diff --git a/src/components/index.ts b/src/components/index.ts index 7bd31164..12a622d2 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -4,7 +4,6 @@ export * from './Badge'; export * from './BuySellForm'; export * from './Checklist'; export * from './Clipboard'; -export * from './CloseHeader'; export * from './Dropdown'; export * from './FileDropzone'; export * from './FloatingRate'; diff --git a/src/routes/AppContent/index.tsx b/src/routes/AppContent/index.tsx index 139bff3e..e1ca1454 100644 --- a/src/routes/AppContent/index.tsx +++ b/src/routes/AppContent/index.tsx @@ -1,6 +1,5 @@ import { useEffect, useState } from 'react'; import { useHistory, useLocation } from 'react-router-dom'; -import { CloseHeader } from '@/components'; import { BUY_SELL_URL } from '@/constants'; import { api } from '@/hooks'; import { AdvertiserInfoStateProvider } from '@/providers/AdvertiserInfoStateProvider'; @@ -67,7 +66,6 @@ const AppContent = () => { setHasCreatedAdvertiser, }} > -