-
Notifications
You must be signed in to change notification settings - Fork 161
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
1 parent
8d646ed
commit e654b21
Showing
11 changed files
with
465 additions
and
23 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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
|
||
function ExampleHint({ isTouchDetected }) { | ||
return ( | ||
<div style={{ | ||
width: '100%', | ||
display: 'flex', | ||
justifyContent: 'center', | ||
position: 'absolute', | ||
bottom: '25px' | ||
}}> | ||
<div style={{ | ||
display: 'flex', | ||
alignItems: 'center', | ||
padding: '5px 10px', | ||
backgroundColor: '#333', | ||
borderRadius: '10px', | ||
opacity: '0.90' | ||
}}> | ||
<img | ||
style={{ | ||
widht: '25px', | ||
height: '25px' | ||
}} | ||
src="data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTkuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDQ5MC4yIDQ5MC4yIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91b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nPgo8L2c+CjxnPgo8L2c+Cjwvc3ZnPgo=" | ||
/> | ||
<span style={{ | ||
fontSize: '14px', | ||
padding: '2px 0 0 5px', | ||
color: 'white' | ||
}}> | ||
{ isTouchDetected ? 'Long-Press to Zoom' : 'Rollover to Zoom' } | ||
</span> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
ExampleHint.displayName = 'ExampleHint' | ||
|
||
ExampleHint.propTypes = { | ||
isTouchDetected: PropTypes.bool, | ||
hintTextMouse: PropTypes.string, | ||
hintTextTouch: PropTypes.string | ||
} | ||
|
||
export default ExampleHint; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
function DefaultHint({ isTouchDetected, hintTextMouse, hintTextTouch }) { | ||
return ( | ||
<div style={{ | ||
width: '100%', | ||
display: 'flex', | ||
justifyContent: 'center', | ||
position: 'absolute', | ||
bottom: '25px' | ||
}}> | ||
<div style={{ | ||
display: 'flex', | ||
alignItems: 'center', | ||
padding: '5px 10px', | ||
backgroundColor: '#333', | ||
borderRadius: '10px', | ||
opacity: '0.90' | ||
}}> | ||
<img | ||
style={{ | ||
widht: '25px', | ||
height: '25px' | ||
}} | ||
src="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2LTY3LjNjMC02LjgtNS41LTEyLjMtMTIuMi0xMi4yYy02LjgsMC0xMi4zLDUuNS0xMi4yLDEyLjJ2NjcuM2gtNjcuM2MtNi44LDAtMTIuMyw1LjUtMTIuMiwxMi4yICAgIGMwLDYuOCw1LjUsMTIuMywxMi4yLDEyLjJoNjcuM3Y2Ny4zQzIzMi44LDMzMS40LDIzOC4zLDMzNi45LDI0NS4xLDMzNi45eiIgZmlsbD0iI0ZGRkZGRiIvPgoJPC9nPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+Cjwvc3ZnPgo=" | ||
/> | ||
<span style={{ | ||
fontSize: '14px', | ||
padding: '2px 0 0 5px', | ||
color: 'white' | ||
}}> | ||
{ isTouchDetected ? hintTextTouch : hintTextMouse } | ||
</span> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
DefaultHint.displayName = 'DefaultHint'; | ||
|
||
DefaultHint.propTypes = { | ||
isTouchDetected: PropTypes.bool, | ||
hintTextMouse: PropTypes.string, | ||
hintTextTouch: PropTypes.string | ||
} | ||
|
||
export default DefaultHint; |
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 from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
export default class DisplayUntilActive extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.hasShown = false; | ||
} | ||
|
||
static propTypes = { | ||
children: PropTypes.element, | ||
isActive: PropTypes.bool, | ||
shouldHideAfterFirstActivation: PropTypes.bool | ||
}; | ||
|
||
static defaultProps = { | ||
shouldHideAfterFirstActivation: true | ||
}; | ||
|
||
setHasShown() { | ||
this.hasShown = true; | ||
} | ||
|
||
render () { | ||
const { | ||
props: { | ||
children, | ||
isActive, | ||
shouldHideAfterFirstActivation | ||
}, | ||
hasShown, | ||
} = this; | ||
const shouldShow = !isActive && (!hasShown || !shouldHideAfterFirstActivation); | ||
|
||
if (isActive && !hasShown) { | ||
this.setHasShown(); | ||
} | ||
|
||
return shouldShow ? children : null; | ||
} | ||
} |
Oops, something went wrong.