Allow icons in Button component

[MAILPOET-2771]
This commit is contained in:
Ján Mikláš
2020-05-04 13:13:24 +02:00
committed by Veljko V
parent 98e570087e
commit 1a6b95b4b9
2 changed files with 30 additions and 2 deletions

View File

@@ -2,11 +2,13 @@ import React from 'react';
import classnames from 'classnames';
type Props = {
children: React.ReactNode,
children?: React.ReactNode,
size?: 'small' | 'large',
variant?: 'light' | 'dark' | 'link' | 'link-dark',
isLoading?: boolean,
isFullWidth?: boolean,
iconStart?: JSX.Element,
iconEnd?: JSX.Element,
onClick?: () => void,
href?: string,
};
@@ -17,6 +19,8 @@ const Button = ({
variant,
isLoading,
isFullWidth,
iconStart,
iconEnd,
onClick,
href,
}: Props) => (
@@ -35,7 +39,9 @@ const Button = ({
)
}
>
<span>{children}</span>
{iconStart}
{children && <span>{children}</span>}
{iconEnd}
</a>
);