mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-23 14:55:44 +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 { BankApi, CustomerApi, SupplierApi } from '@/services/api/master-data';
|
||||||
import { Bank } from '@/types/api/master-data/bank';
|
import { Bank } from '@/types/api/master-data/bank';
|
||||||
import Modal, { useModal } from '@/components/Modal';
|
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 ConfirmationModal from '@/components/modal/ConfirmationModal';
|
||||||
import toast from 'react-hot-toast';
|
import toast from 'react-hot-toast';
|
||||||
import RequirePermission from '@/components/helper/RequirePermission';
|
import RequirePermission from '@/components/helper/RequirePermission';
|
||||||
@@ -64,27 +66,21 @@ const RowOptionsMenu = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='relative'>
|
<div className='relative'>
|
||||||
<Button
|
<PopoverButton
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
variant='ghost'
|
variant='ghost'
|
||||||
color='none'
|
color='none'
|
||||||
className='p-2'
|
|
||||||
popoverTarget={popoverId}
|
popoverTarget={popoverId}
|
||||||
style={{ anchorName: popoverAnchorName } as React.CSSProperties}
|
anchorName={popoverAnchorName}
|
||||||
>
|
>
|
||||||
<Icon icon='material-symbols:more-vert' width={20} height={20} />
|
<Icon icon='material-symbols:more-vert' width={16} height={16} />
|
||||||
</Button>
|
</PopoverButton>
|
||||||
|
|
||||||
<div
|
<PopoverContent
|
||||||
id={popoverId}
|
id={popoverId}
|
||||||
popover='auto'
|
anchorName={popoverAnchorName}
|
||||||
style={{ positionAnchor: popoverAnchorName } as React.CSSProperties}
|
position={popoverPosition === 'bottom' ? 'bottom-start' : 'left'}
|
||||||
className={cn(
|
className='w-full max-w-40 rounded-xl border border-base-content/5 shadow-sm'
|
||||||
'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'
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
<div className='flex flex-col bg-base-100 rounded-xl'>
|
<div className='flex flex-col bg-base-100 rounded-xl'>
|
||||||
<RequirePermission
|
<RequirePermission
|
||||||
@@ -173,7 +169,7 @@ const RowOptionsMenu = ({
|
|||||||
</Button>
|
</Button>
|
||||||
</RequirePermission>
|
</RequirePermission>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</PopoverContent>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user