-
Notifications
You must be signed in to change notification settings - Fork 506
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(finproms): added infor for investment risk
- Loading branch information
Showing
8 changed files
with
1,119 additions
and
5 deletions.
There are no files selected for viewing
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
22 changes: 22 additions & 0 deletions
22
...ages/blockchain-wallet-v4-frontend/src/scenes/Transactions/RiskInvestment/Lines.styles.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,22 @@ | ||
import styled, { css } from 'styled-components' | ||
|
||
export const ListContainer = styled.div<{ | ||
isCollapsed: boolean | ||
}>` | ||
overflow: hidden; | ||
transition: max-height 0.3s ease; | ||
${({ isCollapsed }) => | ||
isCollapsed | ||
? css` | ||
max-height: 40px; | ||
` | ||
: css` | ||
max-height: 200px; | ||
`} | ||
` | ||
|
||
export const ListItem = styled.li` | ||
list-style: none; | ||
overflow: hidden; | ||
` |
49 changes: 49 additions & 0 deletions
49
packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/RiskInvestment/Lines.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,49 @@ | ||
import React, { useState } from 'react' | ||
import { FormattedMessage } from 'react-intl' | ||
import { Button as ConstellationButton } from '@blockchain-com/constellation' | ||
|
||
import { Button, Text } from 'blockchain-info-components' | ||
|
||
import { ListContainer } from './Lines.styles' | ||
|
||
type Props = { | ||
lines: string[] | ||
} | ||
|
||
export const Lines = ({ lines }: Props) => { | ||
const [isCollapsed, setIsCollapsed] = useState(true) | ||
|
||
const toggleCollapse = () => { | ||
setIsCollapsed(!isCollapsed) | ||
} | ||
|
||
return ( | ||
<div> | ||
<ListContainer isCollapsed={isCollapsed}> | ||
<ul className={`list ${isCollapsed ? 'collapsed' : 'expanded'}`}> | ||
{lines.map((line) => ( | ||
<li key={line}> | ||
<Text size='14px' weight={500} color='grey900' lineHeight='150%'> | ||
{line} | ||
</Text> | ||
</li> | ||
))} | ||
</ul> | ||
</ListContainer> | ||
<ConstellationButton | ||
type='button' | ||
variant='minimal' | ||
onClick={toggleCollapse} | ||
data-e2e='toggle-button' | ||
size='small' | ||
text={ | ||
isCollapsed ? ( | ||
<FormattedMessage defaultMessage='Read more' id='buttons.read_more' /> | ||
) : ( | ||
<FormattedMessage defaultMessage='Read less' id='buttons.read_less' /> | ||
) | ||
} | ||
/> | ||
</div> | ||
) | ||
} |
39 changes: 39 additions & 0 deletions
39
...kchain-wallet-v4-frontend/src/scenes/Transactions/RiskInvestment/RiskInvestment.styles.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,39 @@ | ||
import styled from 'styled-components' | ||
|
||
export const MainWrapper = styled.div<{ | ||
expanded: boolean | ||
}>` | ||
margin: 20px 0 30px 0; | ||
display: flex; | ||
flex-direction: column; | ||
border: 1px solid ${(props) => props.theme.grey100}; | ||
border-radius: 16px; | ||
overflow: hidden; | ||
transition: max-height 0.3s ease; | ||
max-height: ${({ expanded }) => (expanded ? '800px' : '50px')}; | ||
` | ||
|
||
export const ContentWrapper = styled.div` | ||
display: flex; | ||
padding: 16px; | ||
flex-direction: column; | ||
gap: 8px; | ||
border-bottom: 1px solid ${(props) => props.theme.grey100}; | ||
&:last-child { | ||
border-bottom: none; | ||
} | ||
` | ||
|
||
export const Title = styled.div` | ||
padding: 16px; | ||
display: flex; | ||
justify-content: space-between; | ||
border-bottom: 1px solid ${(props) => props.theme.grey100}; | ||
` | ||
|
||
export const Arrow = styled.div` | ||
cursor: pointer; | ||
transition: transform 0.3s ease; | ||
` |
931 changes: 931 additions & 0 deletions
931
packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/RiskInvestment/data.json
Large diffs are not rendered by default.
Oops, something went wrong.
65 changes: 65 additions & 0 deletions
65
packages/blockchain-wallet-v4-frontend/src/scenes/Transactions/RiskInvestment/index.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,65 @@ | ||
import React, { useState } from 'react' | ||
import { FormattedMessage } from 'react-intl' | ||
import { | ||
IconChevronDown, | ||
IconChevronDownV2, | ||
IconChevronUp, | ||
IconChevronUpV2, | ||
PaletteColors | ||
} from '@blockchain-com/constellation' | ||
|
||
import { AllCoinsType, Text } from 'blockchain-info-components' | ||
|
||
import data from './data.json' | ||
import { Lines } from './Lines' | ||
import { Arrow, ContentWrapper, MainWrapper, Title } from './RiskInvestment.styles' | ||
|
||
type Props = { | ||
coin: AllCoinsType | ||
} | ||
|
||
export const RiskInvestment = (props: Props) => { | ||
const { coin } = props | ||
const [isExpanded, setIsExpanded] = useState(false) | ||
|
||
const toggleExpanded = () => { | ||
setIsExpanded((prevExpanded) => !prevExpanded) | ||
} | ||
|
||
const coinData = data.find((d) => d.coin === coin) | ||
|
||
if (!coinData) { | ||
return null | ||
} | ||
|
||
return ( | ||
<MainWrapper expanded={isExpanded}> | ||
<Title> | ||
<Text size='16px' weight={600} color='grey900'> | ||
<FormattedMessage | ||
defaultMessage='Investment risk' | ||
id='scenes.coin.investement_risk.title' | ||
/> | ||
</Text> | ||
<Arrow onClick={toggleExpanded}> | ||
{isExpanded ? ( | ||
<IconChevronUpV2 label='up' size='small' /> | ||
) : ( | ||
<IconChevronDownV2 label='down' size='small' /> | ||
)} | ||
</Arrow> | ||
</Title> | ||
{coinData.sections.map((section) => ( | ||
<ContentWrapper key={coin + section.title}> | ||
<Text size='14px' weight={600} color='grey900'> | ||
{section.title} | ||
</Text> | ||
<Text size='14px' weight={500} color='grey900'> | ||
{section.description} | ||
</Text> | ||
<Lines lines={section.lines} /> | ||
</ContentWrapper> | ||
))} | ||
</MainWrapper> | ||
) | ||
} |
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