mirror of
https://github.com/dzeiocom/components.git
synced 2025-06-08 17:19:55 +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 {
|
interface Props {
|
||||||
color?: ColorType
|
color?: ColorType
|
||||||
children?: React.ReactNode
|
children?: React.ReactNode
|
||||||
|
className?: string
|
||||||
icon?: Icon | string
|
icon?: Icon | string
|
||||||
iconLeft?: Icon | string
|
iconLeft?: Icon | string
|
||||||
size?: 'large' | 'small'
|
size?: 'large' | 'small'
|
||||||
type?: 'outline' | 'ghost'
|
type?: 'outline' | 'ghost'
|
||||||
block?: boolean
|
block?: boolean
|
||||||
href?: string
|
href?: string
|
||||||
as?: string
|
linkExternal?: boolean
|
||||||
mobileBlock?: boolean
|
mobileBlock?: boolean
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
loading?: boolean
|
loading?: boolean
|
||||||
onClick?: (event: React.MouseEvent<HTMLButtonElement|HTMLAnchorElement, MouseEvent>) => void
|
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 = () => {
|
public render = () => {
|
||||||
|
|
||||||
@ -57,12 +58,13 @@ export default class Button extends React.Component<Props> {
|
|||||||
[css.block, this.props.block],
|
[css.block, this.props.block],
|
||||||
[css[this.props.size as string], this.props.size],
|
[css[this.props.size as string], this.props.size],
|
||||||
[css.loading, this.props.loading],
|
[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) {
|
if (this.props.href && !this.props.disabled) {
|
||||||
return (
|
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}
|
{inner}
|
||||||
</Link>
|
</Link>
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user