mirror of
https://github.com/dzeiocom/components.git
synced 2025-04-23 19:32:14 +00:00
fix: Button not accepting custom classes
Signed-off-by: Avior <github@avior.me>
This commit is contained in:
parent
2646afae23
commit
128dbe3505
@ -11,20 +11,21 @@ import css from './Button.module.styl'
|
||||
interface Props {
|
||||
color?: ColorType
|
||||
children?: React.ReactNode
|
||||
className?: string
|
||||
icon?: Icon | string
|
||||
iconLeft?: Icon | string
|
||||
size?: 'large' | 'small'
|
||||
type?: 'outline' | 'ghost'
|
||||
block?: boolean
|
||||
href?: string
|
||||
as?: string
|
||||
linkExternal?: boolean
|
||||
mobileBlock?: boolean
|
||||
disabled?: boolean
|
||||
loading?: boolean
|
||||
onClick?: (event: React.MouseEvent<HTMLButtonElement|HTMLAnchorElement, MouseEvent>) => void
|
||||
}
|
||||
|
||||
export default class Button extends React.Component<Props> {
|
||||
export default class Button extends React.PureComponent<Props> {
|
||||
|
||||
public render = () => {
|
||||
|
||||
@ -57,12 +58,13 @@ export default class Button extends React.Component<Props> {
|
||||
[css.block, this.props.block],
|
||||
[css[this.props.size as string], this.props.size],
|
||||
[css.loading, this.props.loading],
|
||||
[css.mobileBlock, this.props.mobileBlock]
|
||||
[css.mobileBlock, this.props.mobileBlock],
|
||||
this.props.className
|
||||
)
|
||||
|
||||
if (this.props.href && !this.props.disabled) {
|
||||
return (
|
||||
<Link linkProps={{onClick: this.props.onClick}} noStyle href={this.props.href} className={buildClassName([classes], [css.disabled, this.props.disabled])}>
|
||||
<Link external={this.props.linkExternal} linkProps={{onClick: this.props.onClick}} noStyle href={this.props.href} className={buildClassName(classes, [css.disabled, this.props.disabled])}>
|
||||
{inner}
|
||||
</Link>
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user