|
|
@ -21,7 +21,6 @@ interface Props { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export function Button(props: Props) { |
|
|
|
export function Button(props: Props) { |
|
|
|
const navigate = useNavigate(); |
|
|
|
|
|
|
|
const { onClick, href, loading } = props; |
|
|
|
const { onClick, href, loading } = props; |
|
|
|
const cb = useCallback( |
|
|
|
const cb = useCallback( |
|
|
|
( |
|
|
|
( |
|
|
@ -31,10 +30,12 @@ export function Button(props: Props) { |
|
|
|
>, |
|
|
|
>, |
|
|
|
) => { |
|
|
|
) => { |
|
|
|
if (loading) return; |
|
|
|
if (loading) return; |
|
|
|
if (href && !onClick) navigate(href); |
|
|
|
if (href && !onClick) { |
|
|
|
else onClick?.(event); |
|
|
|
event.preventDefault(); |
|
|
|
|
|
|
|
window.open(href, "_blank", "noreferrer"); |
|
|
|
|
|
|
|
} else onClick?.(event); |
|
|
|
}, |
|
|
|
}, |
|
|
|
[onClick, href, navigate, loading], |
|
|
|
[onClick, href, loading], |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
let colorClasses = "bg-white hover:bg-gray-200 text-black"; |
|
|
|
let colorClasses = "bg-white hover:bg-gray-200 text-black"; |
|
|
|