mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 20:39:01 +08:00
Fix: default button behavior (#2609)
This commit is contained in:
parent
a4d86496e1
commit
3cf5c1853d
@ -3,16 +3,13 @@ import React from 'react'
|
|||||||
import Spinner from '../spinner'
|
import Spinner from '../spinner'
|
||||||
|
|
||||||
export type IButtonProps = {
|
export type IButtonProps = {
|
||||||
/**
|
type?: string
|
||||||
* The style of the button
|
|
||||||
*/
|
|
||||||
type?: 'primary' | 'warning' | (string & {})
|
|
||||||
className?: string
|
className?: string
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
loading?: boolean
|
loading?: boolean
|
||||||
tabIndex?: number
|
tabIndex?: number
|
||||||
children: React.ReactNode
|
children: React.ReactNode
|
||||||
onClick?: MouseEventHandler<HTMLButtonElement>
|
onClick?: MouseEventHandler<HTMLDivElement>
|
||||||
}
|
}
|
||||||
|
|
||||||
const Button: FC<IButtonProps> = ({
|
const Button: FC<IButtonProps> = ({
|
||||||
@ -38,16 +35,15 @@ const Button: FC<IButtonProps> = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<div
|
||||||
className={`btn ${style} ${className && className}`}
|
className={`btn ${style} ${className && className}`}
|
||||||
tabIndex={tabIndex}
|
tabIndex={tabIndex}
|
||||||
disabled={disabled}
|
onClick={disabled ? undefined : onClick}
|
||||||
onClick={onClick}
|
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
{/* Spinner is hidden when loading is false */}
|
{/* Spinner is hidden when loading is false */}
|
||||||
<Spinner loading={loading} className='!text-white !h-3 !w-3 !border-2 !ml-1' />
|
<Spinner loading={loading} className='!text-white !h-3 !w-3 !border-2 !ml-1' />
|
||||||
</button>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user