mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
refactor(FE): Refactor RowOptionsMenu to use PopoverButton and
PopoverContent
This commit is contained in:
@@ -34,6 +34,8 @@ import { isResponseSuccess } from '@/lib/api-helper';
|
||||
import { BankApi, CustomerApi, SupplierApi } from '@/services/api/master-data';
|
||||
import { Bank } from '@/types/api/master-data/bank';
|
||||
import Modal, { useModal } from '@/components/Modal';
|
||||
import PopoverButton from '@/components/popover/PopoverButton';
|
||||
import PopoverContent from '@/components/popover/PopoverContent';
|
||||
import ConfirmationModal from '@/components/modal/ConfirmationModal';
|
||||
import toast from 'react-hot-toast';
|
||||
import RequirePermission from '@/components/helper/RequirePermission';
|
||||
@@ -64,27 +66,21 @@ const RowOptionsMenu = ({
|
||||
|
||||
return (
|
||||
<div className='relative'>
|
||||
<Button
|
||||
<PopoverButton
|
||||
tabIndex={0}
|
||||
variant='ghost'
|
||||
color='none'
|
||||
className='p-2'
|
||||
popoverTarget={popoverId}
|
||||
style={{ anchorName: popoverAnchorName } as React.CSSProperties}
|
||||
anchorName={popoverAnchorName}
|
||||
>
|
||||
<Icon icon='material-symbols:more-vert' width={20} height={20} />
|
||||
</Button>
|
||||
<Icon icon='material-symbols:more-vert' width={16} height={16} />
|
||||
</PopoverButton>
|
||||
|
||||
<div
|
||||
<PopoverContent
|
||||
id={popoverId}
|
||||
popover='auto'
|
||||
style={{ positionAnchor: popoverAnchorName } as React.CSSProperties}
|
||||
className={cn(
|
||||
'fixed inset-auto bg-base-100 rounded-xl border border-base-content/5 shadow-sm w-full max-w-40 z-[100]',
|
||||
popoverPosition === 'bottom'
|
||||
? 'top-[anchor(bottom)] left-[anchor(left)] mt-1'
|
||||
: 'bottom-[anchor(top)] left-[anchor(left)] mb-1'
|
||||
)}
|
||||
anchorName={popoverAnchorName}
|
||||
position={popoverPosition === 'bottom' ? 'bottom-start' : 'left'}
|
||||
className='w-full max-w-40 rounded-xl border border-base-content/5 shadow-sm'
|
||||
>
|
||||
<div className='flex flex-col bg-base-100 rounded-xl'>
|
||||
<RequirePermission
|
||||
@@ -173,7 +169,7 @@ const RowOptionsMenu = ({
|
||||
</Button>
|
||||
</RequirePermission>
|
||||
</div>
|
||||
</div>
|
||||
</PopoverContent>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user