1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

allow extending button style classes

This commit is contained in:
Matthias Kretschmann 2019-02-15 14:22:51 +01:00
parent 73be4ea648
commit aedfcd9ca0
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -1,8 +1,10 @@
import React, { PureComponent } from 'react'
import cx from 'classnames'
import styles from './Button.module.scss'
interface ButtonProps {
children: string
className?: string
primary?: boolean
link?: boolean
href?: string
@ -12,7 +14,14 @@ interface ButtonProps {
export default class Button extends PureComponent<ButtonProps, any> {
public render() {
let classes
const { primary, link, href, children, ...props } = this.props
const {
primary,
link,
href,
children,
className,
...props
} = this.props
if (primary) {
classes = styles.buttonPrimary
@ -23,11 +32,11 @@ export default class Button extends PureComponent<ButtonProps, any> {
}
return href ? (
<a href={href} className={classes} {...props}>
<a href={href} className={cx(classes, className)} {...props}>
{children}
</a>
) : (
<button className={classes} {...props}>
<button className={cx(classes, className)} {...props}>
{children}
</button>
)