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:
parent
73be4ea648
commit
aedfcd9ca0
@ -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>
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user