Skip to content
This repository was archived by the owner on Jul 9, 2019. It is now read-only.

Commit a976cb0

Browse files
committed
feat: Add Backtick component
1 parent c246bad commit a976cb0

File tree

3 files changed

+679
-539
lines changed

3 files changed

+679
-539
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
"tslint-config-beanloop": "^0.1.0"
2626
},
2727
"dependencies": {
28-
"@types/react": "^15.0.14",
28+
"@types/react": "^15.0.21",
2929
"react-form-helper": "^0.2.1",
30+
"react-motion": "^0.4.7",
3031
"react-with-media": "^0.1.0",
3132
"recompose": "^0.21.2",
3233
"redux-decorated": "^1.0.1",

src/backtick.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import * as React from 'react'
2+
import {StatelessComponent} from 'react'
3+
import {TransitionMotion, spring} from 'react-motion'
4+
import styled from 'styled-components'
5+
6+
export const StyledBacktick: StatelessComponent<{
7+
style?: any
8+
onClick: () => void
9+
}> = styled.div`
10+
position: fixed;
11+
top: 0;
12+
right: 0;
13+
bottom: 0;
14+
left: 0;
15+
z-index: 11;
16+
background-color: rgba(0, 0, 0, 0.54);
17+
will-change: opacity;
18+
`
19+
20+
export const Backtick = ({open, onClick}) =>
21+
<TransitionMotion
22+
willLeave = {() => ({opacity: spring(0)})}
23+
defaultStyles = {[{key: 'backtick', style: {opacity: 0}}]}
24+
styles = {open ? [{key: 'backtick', style: {opacity: spring(1)}}] : []}
25+
>
26+
{interpolatedStyles =>
27+
<div>
28+
{interpolatedStyles.map(config =>
29+
<StyledBacktick onClick={onClick} key={config.key} style={config.style} />
30+
)}
31+
</div>
32+
}
33+
</TransitionMotion>

0 commit comments

Comments
 (0)