-
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.
feat(recurring buy): added new flyout layout and styling shared compo…
…nents and implemented recurring buy first time period picker and confirm screens
- Loading branch information
1 parent
adaf577
commit d0190d8
Showing
35 changed files
with
861 additions
and
397 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
42 changes: 42 additions & 0 deletions
42
packages/blockchain-info-components/src/Flyouts/AmountSubHeader.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,42 @@ | ||
import React, { memo } from 'react' | ||
import styled, { css } from 'styled-components' | ||
|
||
import { Icon } from '../Icons' | ||
import { Text } from '../Text' | ||
|
||
const Amount = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
padding: 0 40px 24px; | ||
> div { | ||
display: flex; | ||
flex-direction: row; | ||
} | ||
` | ||
|
||
const AmountSubHeader = (props: Props) => { | ||
return ( | ||
<Amount data-e2e={props['data-e2e']}> | ||
<div> | ||
<Text size='32px' weight={600} color='grey800'> | ||
{props.title} | ||
</Text> | ||
</div> | ||
<div> | ||
<Text size='20px' weight={600} color='grey600' style={{ marginTop: '8px' }}> | ||
{props.subTitle} | ||
</Text> | ||
</div> | ||
</Amount> | ||
) | ||
} | ||
|
||
export type Props = { | ||
'data-e2e': string | ||
title: string | ||
subTitle: string | ||
} | ||
|
||
export default memo(AmountSubHeader, | ||
(prevProps, nextProps) => | ||
prevProps.title === nextProps.title && prevProps.subTitle === nextProps.subTitle) |
24 changes: 24 additions & 0 deletions
24
packages/blockchain-info-components/src/Flyouts/Container.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, { memo } from 'react' | ||
import styled from 'styled-components' | ||
|
||
const Container = styled.div` | ||
display: flex; | ||
flex: 1; | ||
height: 100%; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
` | ||
|
||
const FlyoutContainer = (props: Props) => { | ||
return ( | ||
<Container> | ||
{props.children} | ||
</Container> | ||
) | ||
} | ||
|
||
export type Props = { | ||
children: React.ReactNode | ||
} | ||
|
||
export default memo(FlyoutContainer) |
23 changes: 23 additions & 0 deletions
23
packages/blockchain-info-components/src/Flyouts/Content.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,23 @@ | ||
import React, { memo } from 'react' | ||
import styled from 'styled-components' | ||
|
||
const Content = styled.div` | ||
display: flex; | ||
flex: 1; | ||
flex-direction: column; | ||
justify-content: flex-start; | ||
` | ||
|
||
const FlyoutContent = (props: Props) => { | ||
return ( | ||
<Content> | ||
{props.children} | ||
</Content> | ||
) | ||
} | ||
|
||
export type Props = { | ||
children: React.ReactNode | ||
} | ||
|
||
export default memo(FlyoutContent) |
122 changes: 122 additions & 0 deletions
122
packages/blockchain-info-components/src/Rows/CheckoutRow.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,122 @@ | ||
import React, { memo, useState } from 'react' | ||
import styled, { css } from 'styled-components' | ||
|
||
import { Icon } from '../Icons' | ||
import { Text } from '../Text' | ||
|
||
const Row = styled.div` | ||
padding: 0 40px; | ||
box-sizing: border-box; | ||
border-top: 1px solid ${(props) => props.theme.grey000}; | ||
&:last-child { | ||
border-bottom: 1px solid ${(props) => props.theme.grey000}; | ||
} | ||
` | ||
|
||
const RowVisible = styled.div` | ||
display: flex; | ||
flex: 1; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
height: 60px; | ||
align-items: center; | ||
` | ||
|
||
const FlatRow = styled.div` | ||
display: flex; | ||
` | ||
|
||
const RowTitle = styled(Text)` | ||
font-size: 14px; | ||
font-weight: 500; | ||
color: ${(props) => props.theme.grey900}; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
` | ||
|
||
const RowValue = styled.div` | ||
text-align: right; | ||
` | ||
|
||
const RowText = styled(RowTitle)` | ||
font-weight: 600; | ||
` | ||
|
||
const AdditionalText = styled(Text)` | ||
font-weight: 500; | ||
color: ${(props) => props.theme.grey400}; | ||
text-align: right; | ||
font-size: 12px; | ||
` | ||
|
||
const IconWrapper = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
cursor: pointer; | ||
margin-left: 4px; | ||
` | ||
|
||
const ToolTipContainer = styled.div` | ||
display: flex; | ||
flex-direction: row; | ||
border-radius: 8px; | ||
margin-top: 8px; | ||
margin-bottom: 8px; | ||
padding: 16px; | ||
background-color: ${(props) => props.theme.grey000}; | ||
animation: fadeIn 0.3s ease-in-out; | ||
@keyframes fadeIn { | ||
0% { | ||
opacity: 0; | ||
} | ||
100% { | ||
opacity: 1; | ||
} | ||
} | ||
` | ||
const CheckoutRow = (props: Props) => { | ||
const [isActiveTooltip, setToolTip] = useState(false) | ||
return ( | ||
<Row> | ||
<RowVisible> | ||
<FlatRow> | ||
<RowTitle>{props.title}</RowTitle> | ||
{props.toolTip && ( | ||
<IconWrapper> | ||
<Icon | ||
name='question-in-circle-filled' | ||
size='16px' | ||
color={isActiveTooltip ? 'blue600' : 'grey300'} | ||
onClick={() => setToolTip(!isActiveTooltip)} | ||
/> | ||
</IconWrapper> | ||
)} | ||
</FlatRow> | ||
<RowValue> | ||
<RowText>{props.text}</RowText> | ||
{props.additionalText && ( | ||
<AdditionalText>{props.additionalText}</AdditionalText> | ||
)} | ||
</RowValue> | ||
</RowVisible> | ||
{props.toolTip && isActiveTooltip && ( | ||
<ToolTipContainer> | ||
{props.toolTip} | ||
</ToolTipContainer> | ||
)} | ||
</Row> | ||
) | ||
} | ||
|
||
export type Props = { | ||
title: string | React.ReactNode | ||
text: string | React.ReactNode | ||
additionalText?: string | React.ReactNode | ||
toolTip?: string | React.ReactNode | ||
} | ||
|
||
export default memo(CheckoutRow) |
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
15 changes: 15 additions & 0 deletions
15
packages/blockchain-info-components/stories/chapters/flyoutAmountSubHeader.stories.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,15 @@ | ||
import React from 'react' | ||
|
||
import { AmountSubHeader } from '../../src' | ||
|
||
export default { | ||
title: 'Flyouts/AmountSubHeader', | ||
component: AmountSubHeader, | ||
args: { | ||
'data-e2e': 'foooo', | ||
title: '10.0000 BTC', | ||
subTitle: '$100' | ||
}, | ||
} | ||
|
||
export const Default = (args) => <AmountSubHeader {...args} /> |
18 changes: 18 additions & 0 deletions
18
packages/blockchain-info-components/stories/chapters/rows.stories.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 { CheckoutRow } from '../../src' | ||
|
||
export default { | ||
title: 'Rows/CheckoutRow', | ||
component: CheckoutRow, | ||
args: { | ||
title: 'Frequency', | ||
text: 'One Time', | ||
additionalText: '' | ||
}, | ||
} | ||
|
||
export const Default = (args) => <CheckoutRow {...args} /> | ||
export const WithAdditionalText = (args) => <CheckoutRow {...args} additionalText='Some other text' /> | ||
export const WithToolTip = (args) => <CheckoutRow {...args} toolTip={'foooooooooo'} additionalText='Some other text' /> | ||
export const ToolTipNoAdditional = (args) => <CheckoutRow {...args} toolTip={'foooooooooo'} /> |
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
Oops, something went wrong.