refactor: refactor the button component using forwardRef (#4379)

Co-authored-by: KVOJJJin <jzongcode@gmail.com>
This commit is contained in:
TinsFox
2024-06-19 14:13:16 +08:00
committed by GitHub
parent bb33ffc332
commit a3bd5eba02
100 changed files with 218 additions and 224 deletions

View File

@@ -197,7 +197,7 @@ const ProviderDetail = ({
<div className='flex items-center py-1 gap-2'>
<div className='relative shrink-0'>
{typeof collection.icon === 'string' && (
<div className='w-8 h-8 bg-center bg-cover bg-no-repeat rounded-md' style={{ backgroundImage: `url(${collection.icon})` }}/>
<div className='w-8 h-8 bg-center bg-cover bg-no-repeat rounded-md' style={{ backgroundImage: `url(${collection.icon})` }} />
)}
{typeof collection.icon !== 'string' && (
<AppIcon
@@ -217,7 +217,7 @@ const ProviderDetail = ({
<div className='flex gap-1 border-b-[0.5px] border-black/5'>
{(collection.type === CollectionType.builtIn) && needAuth && (
<Button
type={isAuthed ? 'default' : 'primary'}
variant={isAuthed ? 'default' : 'primary'}
className={cn('shrink-0 my-3 w-full flex items-center', isAuthed && 'bg-white')}
onClick={() => {
if (collection.type === CollectionType.builtIn || collection.type === CollectionType.model)
@@ -243,7 +243,7 @@ const ProviderDetail = ({
{collection.type === CollectionType.workflow && !isDetailLoading && customCollection && (
<>
<Button
type='primary'
variant='primary'
className={cn('shrink-0 my-3 w-[183px] flex items-center')}
>
<a className='flex items-center text-white' href={`/app/${(customCollection as WorkflowToolProviderResponse).workflow_app_id}/workflow`} rel='noreferrer' target='_blank'>
@@ -263,7 +263,7 @@ const ProviderDetail = ({
</div>
{/* Tools */}
<div className='pt-3'>
{isDetailLoading && <div className='flex h-[200px]'><Loading type='app'/></div>}
{isDetailLoading && <div className='flex h-[200px]'><Loading type='app' /></div>}
{!isDetailLoading && (
<div className='text-xs font-medium leading-6 text-gray-500'>
{collection.type === CollectionType.workflow && <span className=''>{t('tools.createTool.toolInput.title').toLocaleUpperCase()}</span>}