-
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): adding new shared flyout header component and ad…
…ding data and functionality to recurring buy first time buyer flyout
- Loading branch information
1 parent
77d4ca4
commit 6fca6ce
Showing
21 changed files
with
634 additions
and
76 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
module.exports = { | ||
stories: ['../stories/**/*.stories.js'], | ||
stories: ['../stories/**/*.stories.@(js|tsx)'], | ||
addons: [ | ||
'@storybook/addon-essentials', | ||
'@storybook/addon-actions', | ||
'@storybook/addon-links', | ||
'themeprovider-storybook/register' | ||
] | ||
'themeprovider-storybook/register', | ||
'@react-theming/storybook-addon', | ||
'storybook-dark-mode' | ||
], | ||
typescript: { | ||
reactDocgen: 'react-docgen-typescript', | ||
reactDocgenTypescriptOptions: { | ||
compilerOptions: { | ||
allowSyntheticDefaultImports: false, | ||
esModuleInterop: false, | ||
}, | ||
} | ||
} | ||
} |
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,35 @@ | ||
import React from 'react'; | ||
import { ThemeProvider } from 'styled-components'; | ||
import { addDecorator } from '@storybook/react'; | ||
import { withThemes } from '@react-theming/storybook-addon'; | ||
|
||
import { Palette } from '../src/Colors/index' | ||
import { FontGlobalStyles, IconGlobalStyles } from '../src' | ||
|
||
const withTheme = () => (story, context) => { | ||
console.log('fooo', context) | ||
const theme1= Palette('default') | ||
const theme2 = Palette('darkmode') | ||
const theme3 = Palette('compliment') | ||
const theme4 = Palette('greyscale') | ||
const theme5 = Palette('invert') | ||
const theme = context.args.theme ? Palette(context.args.theme) : theme1 | ||
|
||
return ( | ||
<ThemeProvider theme={theme}> | ||
{story()} | ||
</ThemeProvider> | ||
) | ||
} | ||
|
||
const withIconsAndFonts = () => (story) => { | ||
return ( | ||
<> | ||
{story()} | ||
<IconGlobalStyles /> | ||
<FontGlobalStyles /> | ||
</> | ||
) | ||
} | ||
addDecorator(withTheme()) | ||
addDecorator(withIconsAndFonts()) |
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
67 changes: 67 additions & 0 deletions
67
packages/blockchain-info-components/src/Flyouts/Header.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,67 @@ | ||
import React from 'react' | ||
import styled, { css } from 'styled-components' | ||
|
||
import { Icon } from '../Icons' | ||
import { Text } from '../Text' | ||
|
||
const Header = styled.div` | ||
width: 100%; | ||
box-sizing: border-box; | ||
padding: 40px; | ||
border-bottom: ${(p) => p.theme.grey000}; | ||
` | ||
|
||
const TopText = styled(Text)` | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
margin-bottom: 16px; | ||
` | ||
const LeftTopCol = styled.div` | ||
display: flex; | ||
align-items: center; | ||
` | ||
|
||
const FlyoutHeader = (props: Props) => { | ||
return ( | ||
<Header> | ||
<TopText color='grey800' size='20px' weight={600}> | ||
<LeftTopCol> | ||
{props.mode === 'back' && ( | ||
<Icon | ||
cursor | ||
data-e2e={props['data-e2e']} | ||
name='arrow-back' | ||
size='20px' | ||
color='grey600' | ||
role='button' | ||
style={{ marginRight: '8px' }} | ||
onClick={props.onClick} | ||
/> | ||
)} | ||
{props.children} | ||
</LeftTopCol> | ||
{props.mode === 'close' && ( | ||
<Icon | ||
cursor | ||
data-e2e='RecurringBuysCloseButton' | ||
name='close' | ||
size='20px' | ||
color='grey600' | ||
role='button' | ||
onClick={props.onClick} | ||
/> | ||
)} | ||
</TopText> | ||
</Header> | ||
) | ||
} | ||
|
||
export type Props = { | ||
children?: React.ReactNode, | ||
mode: 'close' | 'back' | ||
'data-e2e': string, | ||
onClick: () => void, | ||
} | ||
|
||
export default FlyoutHeader |
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
17 changes: 17 additions & 0 deletions
17
packages/blockchain-info-components/stories/chapters/flyoutHeader.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,17 @@ | ||
import React from 'react' | ||
|
||
import { FlyoutHeader } from '../../src' | ||
|
||
export default { | ||
title: 'Flyouts/Header', | ||
component: FlyoutHeader, | ||
args: { | ||
'data-e2e': 'foooo', | ||
onClick: () => {}, | ||
mode: 'back' | ||
} | ||
} | ||
|
||
export const BackArrowHeader = (args) => <FlyoutHeader {...args}>Buy Bitcoin</FlyoutHeader> | ||
|
||
export const CloseOnlyHeader = (args) => <FlyoutHeader {...args} mode='close' /> |
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
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.