Button adapted to useTabIndex removal

This commit is contained in:
NikolaBorislavovHristov 2019-10-05 22:09:34 +03:00
parent a7e58b1717
commit 7cf24b8180

View file

@ -1,10 +1,8 @@
const React = require('react');
const classnames = require('classnames');
const useTabIndex = require('stremio/common/useTabIndex');
const styles = require('./styles');
const Button = React.forwardRef(({ children, ...props }, ref) => {
const tabIndex = useTabIndex(props.tabIndex, props.disabled);
const onKeyUp = React.useCallback((event) => {
if (typeof props.onKeyUp === 'function') {
props.onKeyUp(event);
@ -29,10 +27,10 @@ const Button = React.forwardRef(({ children, ...props }, ref) => {
return React.createElement(
typeof props.href === 'string' && props.href.length > 0 ? 'a' : 'div',
{
tabIndex: 0,
...props,
ref,
className: classnames(props.className, styles['button-container'], { 'disabled': props.disabled }),
tabIndex,
onKeyUp,
onMouseDown
},