mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
35 lines
832 B
TypeScript
35 lines
832 B
TypeScript
import React, { PureComponent } from 'react'
|
|
import styles from './Button.module.scss'
|
|
|
|
interface IButtonProps {
|
|
children: string
|
|
primary?: boolean
|
|
link?: boolean
|
|
href?: string
|
|
}
|
|
|
|
export default class Button extends PureComponent<IButtonProps, any> {
|
|
public render() {
|
|
let classes
|
|
const { primary, link, href, children, ...props } = this.props
|
|
|
|
if (primary) {
|
|
classes = styles.buttonPrimary
|
|
} else if (link) {
|
|
classes = styles.link
|
|
} else {
|
|
classes = styles.button
|
|
}
|
|
|
|
return href ? (
|
|
<a href={href} className={classes} {...props}>
|
|
{children}
|
|
</a>
|
|
) : (
|
|
<button className={classes} {...props}>
|
|
{children}
|
|
</button>
|
|
)
|
|
}
|
|
}
|