forked from deriv-com/deriv-app
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEQ] / Ameerul / FEQ-1399 create adverts list (deriv-com#13391)
* feat: added buy-sell adverts list desktop * chore: added responsive styling for buy sell table * chore: added new component, fixed styles and testcases * chore: added test cases * fix: eslint errors * chore: empty commit * build: updated quill-icons to the latest version * chore: empty commit * chore: replaced @apply with scss --------- Co-authored-by: Niloofar <niloofar.sadeghi@regentmarkets.com>
- Loading branch information
1 parent
0f6a554
commit d1c6d42
Showing
48 changed files
with
844 additions
and
169 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
packages/p2p-v2/src/components/OnlineStatus/OnlineStatus.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
.p2p-v2-online-status { | ||
&__icon { | ||
position: absolute; | ||
bottom: -0.05px; | ||
right: -0.08px; | ||
margin: 0; | ||
border-radius: 50%; | ||
transform: scale(1.1); | ||
|
||
&--online { | ||
background: #4bb4b3; | ||
} | ||
|
||
&--offline { | ||
background: #999; | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
packages/p2p-v2/src/components/OnlineStatus/OnlineStatusIcon.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react'; | ||
import clsx from 'clsx'; | ||
|
||
type TOnlineStatusIconProps = { | ||
isOnline: boolean; | ||
size?: number | string; | ||
}; | ||
|
||
const OnlineStatusIcon = ({ isOnline, size = '1em' }: TOnlineStatusIconProps) => { | ||
return ( | ||
<div | ||
className={clsx('p2p-v2-online-status__icon', { | ||
'p2p-v2-online-status__icon--offline': !isOnline, | ||
'p2p-v2-online-status__icon--online': !!isOnline, | ||
})} | ||
data-testid='dt_p2p_v2_online_status_icon' | ||
style={{ | ||
height: size, | ||
width: size, | ||
}} | ||
/> | ||
); | ||
}; | ||
|
||
export default OnlineStatusIcon; |
21 changes: 21 additions & 0 deletions
21
packages/p2p-v2/src/components/OnlineStatus/OnlineStatusLabel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react'; | ||
import { getLastOnlineLabel } from '@/utils'; | ||
import { Text, useDevice } from '@deriv-com/ui'; | ||
|
||
type TOnlineStatusLabelProps = { | ||
isOnline: 0 | 1; | ||
lastOnlineTime: number; | ||
}; | ||
|
||
const OnlineStatusLabel = ({ isOnline, lastOnlineTime }: TOnlineStatusLabelProps) => { | ||
const { isMobile } = useDevice(); | ||
const size = isMobile ? 'xs' : 'sm'; | ||
|
||
return ( | ||
<Text color='less-prominent' size={size}> | ||
{getLastOnlineLabel(isOnline, lastOnlineTime)} | ||
</Text> | ||
); | ||
}; | ||
|
||
export default OnlineStatusLabel; |
19 changes: 19 additions & 0 deletions
19
packages/p2p-v2/src/components/OnlineStatus/__tests__/OnlineStatusIcon.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import OnlineStatusIcon from '../OnlineStatusIcon'; | ||
|
||
describe('<OnlineStatusIcon/>', () => { | ||
it('should render the default state as offline', () => { | ||
render(<OnlineStatusIcon isOnline={false} />); | ||
|
||
const icon = screen.getByTestId('dt_p2p_v2_online_status_icon'); | ||
expect(icon).toHaveClass('p2p-v2-online-status__icon--offline'); | ||
}); | ||
|
||
it('should render online state when user is online', () => { | ||
render(<OnlineStatusIcon isOnline />); | ||
|
||
const icon = screen.getByTestId('dt_p2p_v2_online_status_icon'); | ||
expect(icon).toHaveClass('p2p-v2-online-status__icon--online'); | ||
}); | ||
}); |
24 changes: 24 additions & 0 deletions
24
packages/p2p-v2/src/components/OnlineStatus/__tests__/OnlineStatusLabel.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react'; | ||
import { getLastOnlineLabel } from '@/utils'; | ||
import { render, screen } from '@testing-library/react'; | ||
import OnlineStatusLabel from '../OnlineStatusLabel'; | ||
|
||
jest.mock('@deriv-com/ui', () => ({ | ||
...jest.requireActual('@deriv-com/ui'), | ||
useDevice: jest.fn().mockReturnValue({ | ||
isMobile: false, | ||
}), | ||
})); | ||
|
||
jest.mock('@/utils', () => ({ | ||
...jest.requireActual('@/utils'), | ||
getLastOnlineLabel: jest.fn().mockReturnValue('Seen 2 days ago'), | ||
})); | ||
|
||
describe('<OnlineStatusLabel/>', () => { | ||
it('should call the getLastOnlineLabel function with isOnline and lastOnlineTime', () => { | ||
render(<OnlineStatusLabel isOnline={0} lastOnlineTime={1685446791} />); | ||
expect(getLastOnlineLabel).toHaveBeenCalledWith(0, 1685446791); | ||
expect(screen.getByText('Seen 2 days ago')).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import OnlineStatusIcon from './OnlineStatusIcon'; | ||
import OnlineStatusLabel from './OnlineStatusLabel'; | ||
import './OnlineStatus.scss'; | ||
|
||
export { OnlineStatusIcon, OnlineStatusLabel }; |
18 changes: 18 additions & 0 deletions
18
packages/p2p-v2/src/components/PaymentMethodLabel/PaymentMethodLabel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react'; | ||
import { Text } from '@deriv-com/ui'; | ||
|
||
type TPaymentMethodLabelProps = { | ||
color?: string; | ||
paymentMethodName: string; | ||
size?: string; | ||
}; | ||
|
||
const PaymentMethodLabel = ({ color = 'general', paymentMethodName, size = 'sm' }: TPaymentMethodLabelProps) => { | ||
return ( | ||
<Text className='border-solid border-[1px] border-[#D6DADB] rounded-lg px-[8px] py-1' color={color} size={size}> | ||
{paymentMethodName} | ||
</Text> | ||
); | ||
}; | ||
|
||
export default PaymentMethodLabel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as PaymentMethodLabel } from './PaymentMethodLabel'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
.p2p-v2-user-avatar { | ||
align-items: center; | ||
background-color: #ff444f; | ||
border-radius: 50%; | ||
position: relative; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
width: fit-content; | ||
height: fit-content; | ||
|
||
&__short-nickname { | ||
color: #fff; | ||
position: absolute; | ||
} | ||
} |
Oops, something went wrong.