-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
farhan/feat: Added Wallet Carousel to @deriv/wallets (#9847)
* fix(cashier): 🐛 fix unable to access CFD-DerivX transfer * feat(wallets): 📦 add `@deriv/wallets` workspace * fix(wallets): 💚 fix CI build * feat(api): ✨ share a single instance of `QueryClient` in `APIProvider` * Merge branch 'master' into farzin/next * chore: created mobile wallets carousel Co-authored-by: Sergei Baranovski <120570511+sergei-deriv@users.noreply.github.com> --------- Co-authored-by: Farzin Mirzaie <farzin@deriv.com> Co-authored-by: Sergei Baranovski <120570511+sergei-deriv@users.noreply.github.com>
- Loading branch information
1 parent
c3f101d
commit 91f95f4
Showing
9 changed files
with
296 additions
and
0 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
5 changes: 5 additions & 0 deletions
5
packages/wallets/src/components/AccountsList/AccountsList.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,5 @@ | ||
.accounts-list { | ||
height: 60vh; | ||
width: 100vw; | ||
margin-top: 2rem; | ||
} |
18 changes: 18 additions & 0 deletions
18
packages/wallets/src/components/AccountsList/AccountsList.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'; | ||
|
||
type TAccountsListProps = { | ||
data: { | ||
text: string; | ||
background: string; | ||
}; | ||
}; | ||
|
||
const AccountsList = ({ data }: TAccountsListProps) => { | ||
return ( | ||
<div className='accounts-list' style={{ backgroundColor: data.background }}> | ||
AccountsList | ||
</div> | ||
); | ||
}; | ||
|
||
export default AccountsList; |
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,4 @@ | ||
import AccountsList from './AccountsList'; | ||
import './AccountsList.scss'; | ||
|
||
export default AccountsList; |
19 changes: 19 additions & 0 deletions
19
packages/wallets/src/components/WalletCarousel/WalletsCarousel.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,19 @@ | ||
.wallets-carousel { | ||
background-color: #f2f3f4; | ||
width: 100vw; | ||
padding: 2rem; | ||
|
||
&__container { | ||
height: 100%; | ||
display: flex; | ||
align-items: center; | ||
justify-content: flex-start; | ||
gap: 2.4rem; | ||
} | ||
} | ||
|
||
.wallet-card { | ||
width: 100%; | ||
height: 13rem; | ||
border-radius: 10%; | ||
} |
51 changes: 51 additions & 0 deletions
51
packages/wallets/src/components/WalletCarousel/WalletsCarousel.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,51 @@ | ||
import React, { useState } from 'react'; | ||
import useEmblaCarousel from 'embla-carousel-react'; | ||
import AccountsList from '../AccountsList'; | ||
|
||
const WalletsCarousel = () => { | ||
const [emblaRef, emblaApi] = useEmblaCarousel({ skipSnaps: true, containScroll: false }); | ||
const data = [ | ||
{ | ||
text: 'BTC', | ||
background: 'yellow', | ||
}, | ||
{ | ||
text: 'ETH', | ||
background: 'blue', | ||
}, | ||
{ | ||
text: 'USDT', | ||
background: 'red', | ||
}, | ||
]; | ||
|
||
const [active_index, setActiveIndex] = useState(0); | ||
|
||
React.useEffect(() => { | ||
emblaApi?.scrollTo(active_index); | ||
}, [active_index, emblaApi]); | ||
|
||
React.useEffect(() => { | ||
emblaApi?.on('select', () => { | ||
const scroll_snap_index = emblaApi.selectedScrollSnap(); | ||
setActiveIndex(scroll_snap_index); | ||
}); | ||
}, [emblaApi]); | ||
|
||
return ( | ||
<React.Fragment> | ||
<div className='wallets-carousel' ref={emblaRef}> | ||
<section className='wallets-carousel__container'> | ||
{data.map(item => ( | ||
<div className='wallet-card' style={{ backgroundColor: item.background }} key={item.text}> | ||
{item.text} | ||
</div> | ||
))} | ||
</section> | ||
</div> | ||
<AccountsList data={data[active_index]} /> | ||
</React.Fragment> | ||
); | ||
}; | ||
|
||
export default WalletsCarousel; |
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,4 @@ | ||
import WalletsCarousel from './WalletsCarousel'; | ||
import './WalletsCarousel.scss'; | ||
|
||
export default WalletsCarousel; |
91f95f4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
deriv-app – ./
deriv-app-git-master.binary.sx
deriv-app.vercel.app
deriv-app.binary.sx
binary.sx