mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-14 00:40:25 +00:00
extract used props in Button
This commit is contained in:
parent
3912b596cb
commit
80aed6bca3
1 changed files with 3 additions and 3 deletions
|
|
@ -2,7 +2,7 @@ const React = require('react');
|
|||
const classnames = require('classnames');
|
||||
const styles = require('./styles');
|
||||
|
||||
const Button = React.forwardRef(({ children, ...props }, ref) => {
|
||||
const Button = React.forwardRef(({ className, href, disabled, children, ...props }, ref) => {
|
||||
const onKeyDown = React.useCallback((event) => {
|
||||
if (typeof props.onKeyDown === 'function') {
|
||||
props.onKeyDown(event);
|
||||
|
|
@ -25,12 +25,12 @@ const Button = React.forwardRef(({ children, ...props }, ref) => {
|
|||
}
|
||||
}, [props.onMouseDown]);
|
||||
return React.createElement(
|
||||
typeof props.href === 'string' && props.href.length > 0 ? 'a' : 'div',
|
||||
typeof href === 'string' && href.length > 0 ? 'a' : 'div',
|
||||
{
|
||||
tabIndex: 0,
|
||||
...props,
|
||||
ref,
|
||||
className: classnames(props.className, styles['button-container'], { 'disabled': props.disabled }),
|
||||
className: classnames(className, styles['button-container'], { 'disabled': disabled }),
|
||||
onKeyDown,
|
||||
onMouseDown
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue