From aedfcd9ca08b26c2809fde70a91dce4df2ca5015 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Fri, 15 Feb 2019 14:22:51 +0100 Subject: [PATCH] allow extending button style classes --- src/components/atoms/Button.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/atoms/Button.tsx b/src/components/atoms/Button.tsx index a309b7f..312565b 100644 --- a/src/components/atoms/Button.tsx +++ b/src/components/atoms/Button.tsx @@ -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 { 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 { } return href ? ( - + {children} ) : ( - )