Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | 1x 1x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 24x 16x 24x 24x | import { ReactNode } from 'react'
import cn from 'classnames'
import { Button, FCWithChildren } from '@tmk/ui-kit'
import { useWatchOperationForm } from '@/entities/accounting-object'
import { useTranslate } from '@/shared/lib'
export interface OperationsFormLayoutProps {
title?: string
subtitle?: string
isLoading?: boolean
onCancel?: () => void
subTitleClassName?: string
customButtonActions?: ReactNode
actionTitle?: string
}
export const OperationsFormLayout: FCWithChildren<OperationsFormLayoutProps> = ({
title,
subtitle,
children,
isLoading,
onCancel,
className,
subTitleClassName,
customButtonActions,
actionTitle,
}) => {
const { t } = useTranslate(['common'])
useWatchOperationForm()
return (
<div className={cn('w-fit flex flex-col items-center gap-y-2.5 min-w-[400px]', className)}>
<h1>{title}</h1>
<span className={cn('max-w-[350px] text-main-regular text-text text-center', subTitleClassName)}>
{subtitle || `${t('If you are sure that you want to')} ${actionTitle}, ${t('fill in the specifications')}`}
</span>
{children}
{customButtonActions ? (
customButtonActions
) : (
<div className='flex items-center justify-center gap-x-2.5 px-[50px] py-4'>
<Button variant='outlined' color='secondary' onClick={onCancel} className='w-[120px]'>
<h2>{t('Cancel')}</h2>
</Button>
<Button type='submit' className='w-[120px]' loading={isLoading}>
<h2>{t('Execute')}</h2>
</Button>
</div>
)}
</div>
)
}
|