Add Button component without icons
[MAILPOET-2771]
This commit is contained in:
42
assets/js/src/common/button/button.tsx
Normal file
42
assets/js/src/common/button/button.tsx
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import classnames from 'classnames';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
children: React.ReactNode,
|
||||||
|
size?: 'small' | 'large',
|
||||||
|
variant?: 'light' | 'dark' | 'link' | 'link-dark',
|
||||||
|
isLoading?: boolean,
|
||||||
|
isFullWidth?: boolean,
|
||||||
|
onClick?: () => void,
|
||||||
|
href?: string,
|
||||||
|
};
|
||||||
|
|
||||||
|
const Button = ({
|
||||||
|
children,
|
||||||
|
size,
|
||||||
|
variant,
|
||||||
|
isLoading,
|
||||||
|
isFullWidth,
|
||||||
|
onClick,
|
||||||
|
href,
|
||||||
|
}: Props) => (
|
||||||
|
<a
|
||||||
|
href={href}
|
||||||
|
onClick={onClick}
|
||||||
|
className={
|
||||||
|
classnames(
|
||||||
|
'mailpoet-button',
|
||||||
|
{
|
||||||
|
[`mailpoet-button-${size}`]: size,
|
||||||
|
[`mailpoet-button-${variant}`]: variant,
|
||||||
|
'mailpoet-button-loading': isLoading,
|
||||||
|
'mailpoet-full-width': isFullWidth,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<span>{children}</span>
|
||||||
|
</a>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default Button;
|
Reference in New Issue
Block a user