forked from binary-com/deriv-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
thisyahlen/feat: add mt5 account type modal (binary-com#10289)
* feat: add mt5 account type modal * chore: add styles * chore: refactor using widemodal * chore: fix modal and styles * chore: add ts-reset and configure eslint * fix: ci * fix: remove ts-reset * fix: conflicts
- Loading branch information
1 parent
3333ceb
commit d35772f
Showing
21 changed files
with
254 additions
and
187 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
6 changes: 5 additions & 1 deletion
6
...wallets/src/components/ExternalTradingPlatforms/GetMoreMT5Accounts/GetMoreMT5Accounts.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
24 changes: 24 additions & 0 deletions
24
packages/wallets/src/components/ExternalTradingPlatforms/MT5AccountType/MT5AccountType.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,24 @@ | ||
.wallets-mt5-account-type { | ||
display: flex; | ||
align-items: center; | ||
flex-shrink: 0; | ||
border-radius: 8px; | ||
background: var(--system-light-8-primary-background, #fff); | ||
|
||
&-content { | ||
width: 80vw; | ||
height: 70vh; | ||
display: flex; | ||
padding: 24px; | ||
flex-direction: row; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 24px; | ||
flex: 1 0 0; | ||
align-self: stretch; | ||
|
||
@include mobile { | ||
flex-direction: column; | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
packages/wallets/src/components/ExternalTradingPlatforms/MT5AccountType/MT5AccountType.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,48 @@ | ||
import React from 'react'; | ||
import DerivedMT5 from '../../../public/images/mt5-derived.svg'; | ||
import FinancialMT5 from '../../../public/images/mt5-financial.svg'; | ||
import SwapFreeMT5 from '../../../public/images/mt5-swap-free.svg'; | ||
import { MT5AccountTypeCard } from '../MT5AccountTypeCard'; | ||
import './MT5AccountType.scss'; | ||
|
||
const marketTypeDetailsMapper = { | ||
all: { | ||
description: | ||
'Trade swap-free CFDs on MT5 with synthetics, forex, stocks, stock indices, cryptocurrencies, and ETFs.', | ||
icon: <SwapFreeMT5 />, | ||
title: 'Swap-Free', | ||
}, | ||
financial: { | ||
description: 'Trade CFDs on MT5 with forex, stocks and indices, commodities, cryptocurrencies, and ETFs.', | ||
icon: <FinancialMT5 />, | ||
title: 'Financial', | ||
}, | ||
synthetic: { | ||
description: 'Trade CFDs on MT5 with derived indices that simulate real-world market movements.', | ||
icon: <DerivedMT5 />, | ||
title: 'Derived', | ||
}, | ||
}; | ||
|
||
type TProps = { | ||
onMarketTypeSelect: (marketType: keyof typeof marketTypeDetailsMapper) => void; | ||
selectedMarketType?: keyof typeof marketTypeDetailsMapper; | ||
}; | ||
|
||
const MT5AccountType: React.FC<TProps> = ({ onMarketTypeSelect, selectedMarketType }) => ( | ||
<div className='wallets-mt5-account-type-content'> | ||
{Object.entries(marketTypeDetailsMapper).map(([key, value]) => ( | ||
<MT5AccountTypeCard | ||
description={value.description} | ||
icon={value.icon} | ||
isSelected={selectedMarketType === key} | ||
key={key} | ||
// @ts-expect-error the key always is the type of keyof typeof marketTypeDetailsMapper. | ||
onClick={() => onMarketTypeSelect(key === selectedMarketType ? undefined : key)} | ||
title={value.title} | ||
/> | ||
))} | ||
</div> | ||
); | ||
|
||
export default MT5AccountType; |
1 change: 1 addition & 0 deletions
1
packages/wallets/src/components/ExternalTradingPlatforms/MT5AccountType/index.ts
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 MT5AccountType } from './MT5AccountType'; |
67 changes: 67 additions & 0 deletions
67
...allets/src/components/ExternalTradingPlatforms/MT5AccountTypeCard/MT5AccountTypeCard.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,67 @@ | ||
.wallets-mt5-account-type-card { | ||
cursor: pointer; | ||
&-list { | ||
display: flex; | ||
width: 264px; | ||
height: 320px; | ||
align-items: flex-start; | ||
|
||
&-content { | ||
display: flex; | ||
align-items: flex-start; | ||
flex: 1 0 0; | ||
padding: 24px; | ||
align-self: stretch; | ||
border-radius: 16px; | ||
border: 1px solid var(--system-light-5-active-background, #d6dadb); | ||
background: var(--system-light-8-primary-background, #fff); | ||
|
||
&-details { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
gap: 24px; | ||
align-self: stretch; | ||
justify-content: center; | ||
|
||
&-title-description { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
gap: 8px; | ||
align-self: stretch; | ||
} | ||
|
||
&-title { | ||
flex: 1 0 0; | ||
color: var(--system-light-1-prominent-text, #333); | ||
text-align: center; | ||
align-items: center; | ||
display: flex; | ||
|
||
/* desktop/subtitle/Sub 2 - bold */ | ||
font-size: 20px; | ||
font-style: normal; | ||
font-weight: 700; | ||
line-height: 30px; /* 150% */ | ||
} | ||
|
||
&-description { | ||
align-self: stretch; | ||
color: var(--system-light-2-general-text, #333); | ||
text-align: center; | ||
|
||
/* desktop/paragraph/P2 - regular */ | ||
font-size: 14px; | ||
font-style: normal; | ||
font-weight: 400; | ||
line-height: 20px; /* 142.857% */ | ||
} | ||
} | ||
} | ||
} | ||
&-selected { | ||
border-radius: 16px; | ||
box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.2); | ||
} | ||
} |
Oops, something went wrong.