-
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.
- Loading branch information
Showing
167 changed files
with
1,536 additions
and
713 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
module.exports = { | ||
ROOT_URL: 'https://blockchain.info', | ||
API_DOMAIN: 'https://api.blockchain.info', | ||
WEB_SOCKET_URL: 'wss://ws.blockchain.info/inv', | ||
BTC_WEB_SOCKET_URL: 'wss://ws.blockchain.info/inv', | ||
ETH_WEB_SOCKET_URL: 'wss://ws.blockchain.info/eth/inv', | ||
BCH_WEB_SOCKET_URL: 'wss://ws.blockchain.info/bch/inv', | ||
WALLET_HELPER_DOMAIN: 'https://wallet-helper.blockchain.info' | ||
} |
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,6 +1,8 @@ | ||
module.exports = { | ||
ROOT_URL: 'https://testnet.blockchain.info', | ||
API_DOMAIN: 'https://api-testnet.blockchain.info', | ||
WEB_SOCKET_URL: 'wss://ws.blockchain.info/testnet3/inv', | ||
BTC_WEB_SOCKET_URL: 'wss://ws.blockchain.info/testnet3/inv', | ||
ETH_WEB_SOCKET_URL: 'wss://ws.blockchain.info/testnet3/eth/inv', | ||
BCH_WEB_SOCKET_URL: 'wss://ws.blockchain.info/testnet3/bch/inv', | ||
WALLET_HELPER_DOMAIN: 'https://wallet-helper.blockchain.info' | ||
} |
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
41 changes: 0 additions & 41 deletions
41
packages/blockchain-info-components/src/Form/PlaceHolder.js
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
packages/blockchain-info-components/src/Form/PlaceHolder.spec.js
This file was deleted.
Oops, something went wrong.
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
8 changes: 0 additions & 8 deletions
8
packages/blockchain-info-components/src/Form/__snapshots__/PlaceHolder.spec.js.snap
This file was deleted.
Oops, something went wrong.
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: 5 additions & 17 deletions
22
packages/blockchain-info-components/src/Tooltip/Tooltip.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,24 +1,12 @@ | ||
import React from 'react' | ||
import { shallow } from 'enzyme' | ||
import toJson from 'enzyme-to-json' | ||
|
||
import Tooltip from './Tooltip' | ||
import Tooltip from './template.js' | ||
import renderer from 'react-test-renderer' | ||
import 'jest-styled-components' | ||
|
||
describe('Tooltip component', () => { | ||
it('renders correctly', () => { | ||
const component = shallow(<Tooltip><span>Default</span></Tooltip>) | ||
const tree = toJson(component) | ||
const component = renderer.create(<Tooltip colors={{'backgroundColor': '#12345'}}><span>Default</span></Tooltip>) | ||
const tree = component.toJSON() | ||
expect(tree).toMatchSnapshot() | ||
}) | ||
|
||
it('default state is correct', () => { | ||
const component = shallow(<Tooltip />) | ||
expect(component.state().displayed).toBeFalsy() | ||
}) | ||
|
||
it('click handler sets state properly', () => { | ||
const component = shallow(<Tooltip />) | ||
component.instance().handleClick() | ||
expect(component.state().displayed).toBeTruthy() | ||
}) | ||
}) |
122 changes: 101 additions & 21 deletions
122
packages/blockchain-info-components/src/Tooltip/__snapshots__/Tooltip.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 |
---|---|---|
@@ -1,29 +1,109 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Tooltip component renders correctly 1`] = ` | ||
<styled.div> | ||
<styled.div | ||
colors={ | ||
Object { | ||
"backgroundColor": "white", | ||
"borderColor": "gray-2", | ||
"foreColor": "gray-5", | ||
} | ||
} | ||
displayed={false} | ||
onClick={[Function]} | ||
onMouseEnter={[Function]} | ||
onMouseLeave={[Function]} | ||
> | ||
? | ||
</styled.div> | ||
<Styled(TextGroup) | ||
displayed={false} | ||
onClick={[Function]} | ||
.c3 > * { | ||
white-space: normal; | ||
} | ||
.c3 > * { | ||
display: block; | ||
margin-bottom: 10px; | ||
} | ||
.c0 { | ||
width: 22px; | ||
display: -webkit-inline-box; | ||
display: -webkit-inline-flex; | ||
display: -ms-inline-flexbox; | ||
display: inline-flex; | ||
position: relative; | ||
} | ||
.c1 { | ||
display: -webkit-inline-box; | ||
display: -webkit-inline-flex; | ||
display: -ms-inline-flexbox; | ||
display: inline-flex; | ||
-webkit-box-pack: center; | ||
-webkit-justify-content: center; | ||
-ms-flex-pack: center; | ||
justify-content: center; | ||
-webkit-align-items: center; | ||
-webkit-box-align: center; | ||
-ms-flex-align: center; | ||
align-items: center; | ||
width: 16px; | ||
height: 16px; | ||
border-radius: 10px; | ||
border: 1px solid; | ||
cursor: pointer; | ||
font-size: 12px; | ||
font-weight: 300; | ||
} | ||
.c2 { | ||
position: absolute; | ||
bottom: 150%; | ||
left: -115px; | ||
text-align: initial; | ||
width: 250px; | ||
display: none; | ||
border: 1px solid; | ||
border-radius: 5px; | ||
padding: 10px 10px; | ||
box-sizing: border-box; | ||
cursor: pointer; | ||
font-size: 11px; | ||
font-weight: 300; | ||
font-family: "Montserrat",sans serif; | ||
text-align: left; | ||
} | ||
.c2 > div, | ||
.c2 > span { | ||
margin-bottom: 0px; | ||
} | ||
.c2:before { | ||
content: ''; | ||
display: block; | ||
position: absolute; | ||
left: 115px; | ||
top: 100%; | ||
width: 0; | ||
height: 0; | ||
border: 10px solid transparent; | ||
} | ||
.c2:after { | ||
content: ''; | ||
display: block; | ||
position: absolute; | ||
left: 116px; | ||
top: 100%; | ||
width: 0; | ||
height: 0; | ||
border: 9px solid transparent; | ||
} | ||
<div | ||
className="c0" | ||
width={undefined} | ||
> | ||
<div | ||
className="c1" | ||
onClick={undefined} | ||
onMouseEnter={undefined} | ||
onMouseLeave={undefined} | ||
/> | ||
<div | ||
className="c2 c3" | ||
onClick={undefined} | ||
width={undefined} | ||
> | ||
<span> | ||
Default | ||
</span> | ||
</Styled(TextGroup)> | ||
</styled.div> | ||
</div> | ||
</div> | ||
`; |
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 +1,54 @@ | ||
export { default as Tooltip } from './Tooltip' | ||
import React from 'react' | ||
import onClickOutside from 'react-onclickoutside' | ||
import Tooltip from './template.js' | ||
|
||
class TooltipContainer extends React.PureComponent { | ||
constructor (props) { | ||
super(props) | ||
this.state = { displayed: false } | ||
this.handleClick = this.handleClick.bind(this) | ||
this.handleMouseEnter = this.handleMouseEnter.bind(this) | ||
this.handleMouseLeave = this.handleMouseLeave.bind(this) | ||
} | ||
|
||
handleClick () { | ||
this.setState({ displayed: !this.state.displayed }) | ||
} | ||
|
||
handleMouseEnter () { | ||
this.props.hover && this.setState({ displayed: true }) | ||
} | ||
|
||
handleMouseLeave () { | ||
this.props.hover && this.setState({ displayed: false }) | ||
} | ||
|
||
handleClickOutside () { | ||
this.setState({ displayed: false }) | ||
} | ||
|
||
render () { | ||
const selectColors = displayed => displayed | ||
? { foreColor: 'white', backgroundColor: 'brand-primary', borderColor: 'brand-primary' } | ||
: { foreColor: 'gray-5', backgroundColor: 'white', borderColor: 'gray-2' } | ||
|
||
const icon = this.state.displayed ? 'X' : '?' | ||
const colors = selectColors(this.state.displayed) | ||
|
||
return ( | ||
<Tooltip | ||
icon={icon} | ||
colors={colors} | ||
width={this.props.width} | ||
label={this.props.label} | ||
displayed={this.state.displayed} | ||
handleClick={this.handleClick} | ||
handleMouseEnter={this.handleMouseEnter} | ||
handleMouseLeave={this.handleMouseLeave}> | ||
{this.props.children} | ||
</Tooltip> | ||
) | ||
} | ||
} | ||
|
||
export default onClickOutside(TooltipContainer) |
Oops, something went wrong.