mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
chore: render button only if primary or secondary button is used
This commit is contained in:
@@ -167,49 +167,61 @@ const ConfirmationModal = ({
|
|||||||
|
|
||||||
{children && <div className='w-full'>{children}</div>}
|
{children && <div className='w-full'>{children}</div>}
|
||||||
|
|
||||||
<div className='w-full grid grid-cols-2 gap-3'>
|
{(secondaryButton || primaryButton) && (
|
||||||
{secondaryButton && secondaryButton.text && (
|
<div
|
||||||
<Button
|
className={cn('w-full grid gap-3', {
|
||||||
{...secondaryButton}
|
'grid-cols-2': secondaryButton && primaryButton,
|
||||||
variant='outline'
|
'grid-cols-1':
|
||||||
color={secondaryButton?.color}
|
(secondaryButton && !primaryButton) ||
|
||||||
isLoading={secondaryButton?.isLoading}
|
(!secondaryButton && primaryButton),
|
||||||
disabled={
|
})}
|
||||||
secondaryButton?.isLoading !== undefined
|
>
|
||||||
? secondaryButton?.isLoading
|
{secondaryButton && secondaryButton.text && (
|
||||||
: isPrimaryButtonLoading
|
<Button
|
||||||
}
|
{...secondaryButton}
|
||||||
onClick={closeModalHandler}
|
variant='outline'
|
||||||
className={cn(
|
color={secondaryButton?.color}
|
||||||
'p-2 rounded-xl text-sm',
|
isLoading={secondaryButton?.isLoading}
|
||||||
secondaryButton?.className
|
disabled={
|
||||||
)}
|
secondaryButton?.isLoading !== undefined
|
||||||
>
|
? secondaryButton?.isLoading
|
||||||
{secondaryButton?.text ?? 'Tidak'}
|
: isPrimaryButtonLoading
|
||||||
</Button>
|
}
|
||||||
)}
|
onClick={closeModalHandler}
|
||||||
|
className={cn(
|
||||||
|
'p-2 rounded-xl text-sm',
|
||||||
|
secondaryButton?.className
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{secondaryButton?.text ?? 'Tidak'}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
|
||||||
{primaryButton && primaryButton.text && (
|
{primaryButton && primaryButton.text && (
|
||||||
<Button
|
<Button
|
||||||
{...primaryButton}
|
{...primaryButton}
|
||||||
color={primaryButton?.color ?? 'info'}
|
color={primaryButton?.color ?? 'info'}
|
||||||
onClick={primaryButtonClickHandler}
|
onClick={primaryButtonClickHandler}
|
||||||
isLoading={
|
isLoading={
|
||||||
primaryButton?.isLoading !== undefined
|
primaryButton?.isLoading !== undefined
|
||||||
? primaryButton?.isLoading
|
? primaryButton?.isLoading
|
||||||
: isPrimaryButtonLoading
|
: isPrimaryButtonLoading
|
||||||
}
|
}
|
||||||
disabled={
|
disabled={
|
||||||
primaryButton?.isLoading !== undefined
|
primaryButton?.isLoading !== undefined
|
||||||
? primaryButton?.isLoading
|
? primaryButton?.isLoading
|
||||||
: isPrimaryButtonLoading
|
: isPrimaryButtonLoading
|
||||||
}
|
}
|
||||||
className={cn('p-2 rounded-xl text-sm', primaryButton?.className)}
|
className={cn(
|
||||||
>
|
'p-2 rounded-xl text-sm',
|
||||||
{primaryButton?.text ?? 'Ya'}
|
primaryButton?.className
|
||||||
</Button>
|
)}
|
||||||
)}
|
>
|
||||||
</div>
|
{primaryButton?.text ?? 'Ya'}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user