meriadec
7 years ago
No known key found for this signature in database
GPG Key ID: 1D2FC2305E2CB399
2 changed files with
19 additions and
1 deletions
-
.eslintrc
-
src/components/base/Box/index.js
|
|
@ -7,6 +7,7 @@ |
|
|
|
"__DEV__": false, |
|
|
|
"__PROD__": false, |
|
|
|
"__static": false, |
|
|
|
"window": false, |
|
|
|
}, |
|
|
|
"rules": { |
|
|
|
"camelcase": 0, |
|
|
|
|
|
@ -1,6 +1,6 @@ |
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React from 'react' |
|
|
|
import React, { PureComponent } from 'react' |
|
|
|
import styled from 'styled-components' |
|
|
|
import { |
|
|
|
alignItems, |
|
|
@ -79,4 +79,21 @@ export const GrowScroll = (props: *) => ( |
|
|
|
</Box> |
|
|
|
) |
|
|
|
|
|
|
|
export class Tabbable extends PureComponent<any> { |
|
|
|
componentDidMount() { |
|
|
|
window.addEventListener('keydown', this.handleKeydown) |
|
|
|
} |
|
|
|
componentWillUnmount() { |
|
|
|
window.removeEventListener('keydown', this.handleKeydown) |
|
|
|
} |
|
|
|
handleKeydown = (e: SyntheticKeyboardEvent<any>) => { |
|
|
|
if (e.which === 13 && this.props.onClick) { |
|
|
|
this.props.onClick(e) |
|
|
|
} |
|
|
|
} |
|
|
|
render() { |
|
|
|
return <Box tabIndex={0} {...this.props} /> |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export default Box |
|
|
|