-
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(Swap): added support modal to swap menu
- Loading branch information
1 parent
ced10fe
commit 79a9d9e
Showing
9 changed files
with
184 additions
and
13 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
47 changes: 47 additions & 0 deletions
47
...blockchain-wallet-v4-frontend/src/modals/Generic/Support/__snapshots__/index.spec.js.snap
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,47 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Support modal component matches snapshot 1`] = ` | ||
<Modal | ||
size="small" | ||
> | ||
<Support__Body | ||
data-e2e="swapGetStarted" | ||
> | ||
<Support__Title | ||
size="20px" | ||
> | ||
<FormattedHTMLMessage | ||
defaultMessage="Need some help?" | ||
id="modals.support.need_some_help" | ||
values={Object {}} | ||
/> | ||
</Support__Title> | ||
<Support__Message> | ||
<FormattedMessage | ||
defaultMessage="Our Blockchain Support Team is standing by." | ||
id="modals.support.our_support" | ||
values={Object {}} | ||
/> | ||
</Support__Message> | ||
<Support__FooterLink | ||
href="https://blockchain.zendesk.com/hc/en-us/requests/new?ticket_form_id=360000180551" | ||
target="_blank" | ||
> | ||
<Support__FooterButton | ||
fullwidth={true} | ||
nature="primary" | ||
size="20px" | ||
> | ||
<FormattedMessage | ||
defaultMessage="Contact Support" | ||
id="modals.support.contact_support" | ||
values={Object {}} | ||
/> | ||
</Support__FooterButton> | ||
</Support__FooterLink> | ||
<Support__BottomImage | ||
name="identity-verification" | ||
/> | ||
</Support__Body> | ||
</Modal> | ||
`; |
77 changes: 77 additions & 0 deletions
77
packages/blockchain-wallet-v4-frontend/src/modals/Generic/Support/index.js
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,77 @@ | ||
import React from 'react' | ||
import styled from 'styled-components' | ||
import { FormattedMessage, FormattedHTMLMessage } from 'react-intl' | ||
|
||
import modalEnhancer from 'providers/ModalEnhancer' | ||
import { Button, Image, Link, Modal, Text } from 'blockchain-info-components' | ||
|
||
const Body = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: flex-start; | ||
align-items: center; | ||
height: 435px; | ||
padding: 48px 32px 0 32px; | ||
box-sizing: border-box; | ||
text-align: center; | ||
` | ||
const Title = styled(Text)` | ||
margin-bottom: 16px; | ||
font-size: 26px; | ||
b { | ||
font-weight: 500; | ||
color: ${props => props.theme.success}; | ||
} | ||
` | ||
const Message = styled(Text)` | ||
margin-bottom: 24px; | ||
font-size: 18px; | ||
` | ||
const BottomImage = styled(Image)` | ||
width: 100%; | ||
align-self: flex-end; | ||
` | ||
const FooterLink = styled(Link)` | ||
height: auto; | ||
width: 100%; | ||
` | ||
const FooterButton = styled(Button)` | ||
height: 100%; | ||
font-size: 17px; | ||
font-weight: 400; | ||
padding: 15px 0; | ||
margin-bottom: 32px; | ||
` | ||
|
||
export const Support = ({ position, total }) => ( | ||
<Modal size='small' position={position} total={total}> | ||
<Body data-e2e='swapGetStarted'> | ||
<Title size='20px'> | ||
<FormattedHTMLMessage | ||
defaultMessage='Need some help?' | ||
id='modals.support.need_some_help' | ||
/> | ||
</Title> | ||
<Message> | ||
<FormattedMessage | ||
defaultMessage='Our Blockchain Support Team is standing by.' | ||
id='modals.support.our_support' | ||
/> | ||
</Message> | ||
<FooterLink | ||
href='https://blockchain.zendesk.com/hc/en-us/requests/new?ticket_form_id=360000180551' | ||
target='_blank' | ||
> | ||
<FooterButton nature='primary' size='20px' fullwidth> | ||
<FormattedMessage | ||
defaultMessage='Contact Support' | ||
id='modals.support.contact_support' | ||
/> | ||
</FooterButton> | ||
</FooterLink> | ||
<BottomImage name='identity-verification' /> | ||
</Body> | ||
</Modal> | ||
) | ||
|
||
export default modalEnhancer('Support')(Support) |
12 changes: 12 additions & 0 deletions
12
packages/blockchain-wallet-v4-frontend/src/modals/Generic/Support/index.spec.js
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,12 @@ | ||
import React from 'react' | ||
import { shallow } from 'enzyme' | ||
import toJson from 'enzyme-to-json' | ||
import { Support } from './index' | ||
|
||
describe('Support modal component', () => { | ||
it('matches snapshot', () => { | ||
const component = shallow(<Support />) | ||
const tree = toJson(component) | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
}) |
3 changes: 2 additions & 1 deletion
3
packages/blockchain-wallet-v4-frontend/src/modals/Generic/index.js
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,4 +1,5 @@ | ||
import Confirm from './Confirm' | ||
import PromptInput from './PromptInput' | ||
import Support from './Support' | ||
|
||
export { Confirm, PromptInput } | ||
export { Confirm, PromptInput, Support } |
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: 12 additions & 5 deletions
17
packages/blockchain-wallet-v4-frontend/src/scenes/Exchange/Menu/index.spec.js
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,26 +1,33 @@ | ||
import React from 'react' | ||
import { shallow } from 'enzyme' | ||
import toJson from 'enzyme-to-json' | ||
import { MenuTop } from './index' | ||
import { Menu } from './index' | ||
|
||
jest.mock('blockchain-info-components', () => ({ | ||
Images: '', | ||
Button: '', | ||
TextGroup: '', | ||
TabMenu: '', | ||
TabMenuItem: '' | ||
})) | ||
|
||
describe('MenuTop Component', () => { | ||
describe('Menu Component', () => { | ||
it('should render with correct links and without error', () => { | ||
const component = shallow(<MenuTop />) | ||
const component = shallow(<Menu />) | ||
const LinkContainer = component.find('LinkContainer') | ||
expect(LinkContainer.at(0).prop('to')).toBe('/swap') | ||
expect(LinkContainer.at(1).prop('to')).toBe('/swap/history') | ||
}) | ||
|
||
it('matches snapshot', () => { | ||
const component = shallow(<MenuTop />) | ||
const component = shallow(<Menu />) | ||
const tree = toJson(component) | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
|
||
it('should trigger showHelpModal on button click', () => { | ||
const showHelpModal = jest.fn() | ||
const component = shallow(<Menu showHelpModal={showHelpModal} />) | ||
component.find('Menu__SupportButton').simulate('click') | ||
expect(showHelpModal).toHaveBeenCalledTimes(1) | ||
}) | ||
}) |