|
|
|
@ -8,22 +8,30 @@ export type SuggestedActionProps = PropsWithChildren<HTMLProps<HTMLAnchorElement
|
|
|
|
disabled?: boolean
|
|
|
|
disabled?: boolean
|
|
|
|
}>
|
|
|
|
}>
|
|
|
|
|
|
|
|
|
|
|
|
const SuggestedAction = ({ icon, link, disabled, children, className, ...props }: SuggestedActionProps) => (
|
|
|
|
const SuggestedAction = ({ icon, link, disabled, children, className, onClick, ...props }: SuggestedActionProps) => {
|
|
|
|
<a
|
|
|
|
const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
|
|
|
|
href={disabled ? undefined : link}
|
|
|
|
if (disabled)
|
|
|
|
target='_blank'
|
|
|
|
return
|
|
|
|
rel='noreferrer'
|
|
|
|
onClick?.(e)
|
|
|
|
className={classNames(
|
|
|
|
}
|
|
|
|
'flex-1 flex justify-start items-center gap-2 h-[34px] px-2.5 bg-gray-100 rounded-lg transition-colors [&:not(:first-child)]:mt-1',
|
|
|
|
return (
|
|
|
|
disabled ? 'shadow-xs opacity-30 cursor-not-allowed' : 'hover:bg-primary-50 hover:text-primary-600 cursor-pointer',
|
|
|
|
<a
|
|
|
|
className,
|
|
|
|
href={disabled ? undefined : link}
|
|
|
|
)}
|
|
|
|
target='_blank'
|
|
|
|
{...props}
|
|
|
|
rel='noreferrer'
|
|
|
|
>
|
|
|
|
className={classNames(
|
|
|
|
<div className='relative w-4 h-4'>{icon}</div>
|
|
|
|
'flex-1 flex justify-start items-center text-text-secondary gap-2 h-[34px] px-2.5 bg-gray-100 rounded-lg transition-colors [&:not(:first-child)]:mt-1',
|
|
|
|
<div className='grow shrink basis-0 text-[13px] font-medium leading-[18px]'>{children}</div>
|
|
|
|
disabled ? 'shadow-xs opacity-30 cursor-not-allowed' : 'hover:bg-primary-50 hover:text-primary-600 cursor-pointer',
|
|
|
|
<ArrowUpRight />
|
|
|
|
className,
|
|
|
|
</a>
|
|
|
|
)}
|
|
|
|
)
|
|
|
|
onClick={handleClick}
|
|
|
|
|
|
|
|
{...props}
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<div className='relative w-4 h-4'>{icon}</div>
|
|
|
|
|
|
|
|
<div className='grow shrink basis-0 text-[13px] font-medium leading-[18px]'>{children}</div>
|
|
|
|
|
|
|
|
<ArrowUpRight />
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default SuggestedAction
|
|
|
|
export default SuggestedAction
|
|
|
|
|