mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 09:49:03 +08:00
refactor: replace div with button for better accessibility (#12046)
This commit is contained in:
parent
56e15d09a9
commit
cdaef30cc9
@ -18,7 +18,6 @@ export type CreateAppCardProps = {
|
|||||||
onSuccess?: () => void
|
onSuccess?: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line react/display-name
|
|
||||||
const CreateAppCard = forwardRef<HTMLDivElement, CreateAppCardProps>(({ className, onSuccess }, ref) => {
|
const CreateAppCard = forwardRef<HTMLDivElement, CreateAppCardProps>(({ className, onSuccess }, ref) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { onPlanInfoChanged } = useProviderContext()
|
const { onPlanInfoChanged } = useProviderContext()
|
||||||
@ -44,24 +43,22 @@ const CreateAppCard = forwardRef<HTMLDivElement, CreateAppCardProps>(({ classNam
|
|||||||
>
|
>
|
||||||
<div className='grow p-2 rounded-t-xl'>
|
<div className='grow p-2 rounded-t-xl'>
|
||||||
<div className='px-6 pt-2 pb-1 text-xs font-medium leading-[18px] text-text-tertiary'>{t('app.createApp')}</div>
|
<div className='px-6 pt-2 pb-1 text-xs font-medium leading-[18px] text-text-tertiary'>{t('app.createApp')}</div>
|
||||||
<div className='flex items-center mb-1 px-6 py-[7px] rounded-lg text-[13px] font-medium leading-[18px] text-text-tertiary cursor-pointer hover:text-text-secondary hover:bg-state-base-hover' onClick={() => setShowNewAppModal(true)}>
|
<button className='w-full flex items-center mb-1 px-6 py-[7px] rounded-lg text-[13px] font-medium leading-[18px] text-text-tertiary cursor-pointer hover:text-text-secondary hover:bg-state-base-hover' onClick={() => setShowNewAppModal(true)}>
|
||||||
<FilePlus01 className='shrink-0 mr-2 w-4 h-4' />
|
<FilePlus01 className='shrink-0 mr-2 w-4 h-4' />
|
||||||
{t('app.newApp.startFromBlank')}
|
{t('app.newApp.startFromBlank')}
|
||||||
</div>
|
</button>
|
||||||
<div className='flex items-center px-6 py-[7px] rounded-lg text-[13px] font-medium leading-[18px] text-text-tertiary cursor-pointer hover:text-text-secondary hover:bg-state-base-hover' onClick={() => setShowNewAppTemplateDialog(true)}>
|
<button className='w-full flex items-center px-6 py-[7px] rounded-lg text-[13px] font-medium leading-[18px] text-text-tertiary cursor-pointer hover:text-text-secondary hover:bg-state-base-hover' onClick={() => setShowNewAppTemplateDialog(true)}>
|
||||||
<FilePlus02 className='shrink-0 mr-2 w-4 h-4' />
|
<FilePlus02 className='shrink-0 mr-2 w-4 h-4' />
|
||||||
{t('app.newApp.startFromTemplate')}
|
{t('app.newApp.startFromTemplate')}
|
||||||
</div>
|
</button>
|
||||||
</div>
|
<button
|
||||||
<div
|
onClick={() => setShowCreateFromDSLModal(true)}
|
||||||
className='p-2 border-t-[0.5px] border-components-card-border rounded-b-xl'
|
className='w-full flex items-center px-6 py-[7px] rounded-lg text-[13px] font-medium leading-[18px] text-text-tertiary cursor-pointer hover:text-text-secondary hover:bg-state-base-hover'>
|
||||||
onClick={() => setShowCreateFromDSLModal(true)}
|
|
||||||
>
|
|
||||||
<div className='flex items-center px-6 py-[7px] rounded-lg text-[13px] font-medium leading-[18px] text-text-tertiary cursor-pointer hover:text-text-secondary hover:bg-state-base-hover'>
|
|
||||||
<FileArrow01 className='shrink-0 mr-2 w-4 h-4' />
|
<FileArrow01 className='shrink-0 mr-2 w-4 h-4' />
|
||||||
{t('app.importDSL')}
|
{t('app.importDSL')}
|
||||||
</div>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<CreateAppModal
|
<CreateAppModal
|
||||||
show={showNewAppModal}
|
show={showNewAppModal}
|
||||||
onClose={() => setShowNewAppModal(false)}
|
onClose={() => setShowNewAppModal(false)}
|
||||||
@ -108,4 +105,6 @@ const CreateAppCard = forwardRef<HTMLDivElement, CreateAppCardProps>(({ classNam
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
CreateAppCard.displayName = 'CreateAppCard'
|
||||||
export default CreateAppCard
|
export default CreateAppCard
|
||||||
|
export { CreateAppCard }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user