1
1
import React from 'react'
2
2
import Link from 'next/link'
3
3
import PropTypes from 'prop-types'
4
- import Button from '../../components/Button/Button'
4
+ import Button , { buttonPropTypes } from '../../components/Button/Button'
5
5
import './linked-button.css'
6
6
7
7
/**
@@ -16,18 +16,22 @@ const LinkedButton = ({ addClass, buttonProps, path }) => (
16
16
< ButtonLinkWrapper
17
17
addClass = { addClass }
18
18
buttonProps = { buttonProps }
19
- href = { path }
20
19
/>
21
20
</ Link >
22
21
)
23
22
24
- const ButtonLinkWrapper = React . forwardRef ( ( { addClass, buttonProps, href } , ref ) => (
25
- < a href = { href } ref = { ref } className = { addClass } >
26
- < Button { ...buttonProps } />
27
- </ a >
28
- ) )
23
+ const ButtonLinkWrapper = React . forwardRef ( ( { ...props } , ref ) => {
24
+ // eslint-disable-next-line react/prop-types
25
+ const { addClass, buttonProps, href } = props
29
26
30
- const { onClick, ...remainingPropTypes } = Button . propTypes
27
+ return (
28
+ < a href = { href } ref = { ref } className = { addClass } >
29
+ < Button { ...buttonProps } />
30
+ </ a >
31
+ )
32
+ } )
33
+
34
+ const { onClick, ...remainingPropTypes } = buttonPropTypes
31
35
32
36
LinkedButton . propTypes = {
33
37
buttonProps : PropTypes . shape ( remainingPropTypes ) . isRequired ,
@@ -45,7 +49,6 @@ LinkedButton.defaultProps = {
45
49
ButtonLinkWrapper . propTypes = {
46
50
addClass : PropTypes . string ,
47
51
buttonProps : PropTypes . shape ( remainingPropTypes ) . isRequired ,
48
- href : PropTypes . string . isRequired ,
49
52
}
50
53
51
54
ButtonLinkWrapper . defaultProps = {
0 commit comments