Add click prop to Button
This commit is contained in:
parent
5d94cb18ca
commit
2907980d36
1 changed files with 4 additions and 2 deletions
|
|
@ -7,11 +7,13 @@ import Link from '../../assets/link.svg'
|
|||
|
||||
interface Props {
|
||||
type: string
|
||||
click: () => void
|
||||
}
|
||||
|
||||
class Button extends React.Component<Props> {
|
||||
static defaultProps: Props = {
|
||||
type: null
|
||||
type: null,
|
||||
click: () => {}
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
@ -24,7 +26,7 @@ class Button extends React.Component<Props> {
|
|||
icon = <span className='icon'><Link /></span>
|
||||
}
|
||||
|
||||
return <button className='Button'>
|
||||
return <button className='Button' onClick={this.props.click}>
|
||||
{icon}
|
||||
<span className='text'>{this.props.children}</span>
|
||||
</button>
|
||||
|
|
|
|||
Loading…
Reference in a new issue