-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6354 from blockchain/feat/GROWUX-3484-fin-prom-me…
…ssage feat(finproms): added info for investment risk
- Loading branch information
Showing
9 changed files
with
1,104 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
10 changes: 10 additions & 0 deletions
10
...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,10 @@ | ||
import styled from 'styled-components' | ||
|
||
export const ListContainer = styled.div<{ | ||
$isCollapsed: boolean | ||
}>` | ||
overflow: hidden; | ||
transition: max-height 0.3s ease; | ||
max-height: ${(props) => (props.$isCollapsed ? '40px' : '200px')}; | ||
` |
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 { 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> | ||
{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.
58 changes: 58 additions & 0 deletions
58
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,58 @@ | ||
import React, { useState } from 'react' | ||
import { FormattedMessage } from 'react-intl' | ||
import { IconChevronDownV2, IconChevronUpV2 } 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 = ({ 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
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