refactor(FE-Storyless): simplify RowOptionsMenu by using RowOptionsMenuWrapper and enhance button layout

This commit is contained in:
rstubryan
2025-11-03 09:44:50 +07:00
parent ac11559754
commit 2ba23654ce
@@ -20,6 +20,7 @@ import DebouncedTextInput from '@/components/input/DebouncedTextInput';
import SelectInput from '@/components/input/SelectInput'; import SelectInput from '@/components/input/SelectInput';
import RowDropdownOptions from '@/components/table/RowDropdownOptions'; import RowDropdownOptions from '@/components/table/RowDropdownOptions';
import RowCollapseOptions from '@/components/table/RowCollapseOptions'; import RowCollapseOptions from '@/components/table/RowCollapseOptions';
import RowOptionsMenuWrapper from '@/components/table/RowOptionsMenuWrapper';
const RowOptionsMenu = ({ const RowOptionsMenu = ({
type = 'dropdown', type = 'dropdown',
@@ -27,18 +28,8 @@ const RowOptionsMenu = ({
}: { }: {
type: 'dropdown' | 'collapse'; type: 'dropdown' | 'collapse';
props: CellContext<Movement, unknown>; props: CellContext<Movement, unknown>;
}) => { }) => (
return ( <RowOptionsMenuWrapper type={type}>
<div
tabIndex={type === 'dropdown' ? 0 : undefined}
className={cn(
{
'dropdown-content': type === 'dropdown',
'mt-2': type === 'collapse',
},
'p-2.5 mr-2 flex flex-col gap-1 bg-base-100 rounded-box z-10 border border-black/10 shadow'
)}
>
<Button <Button
href={`/inventory/movement/detail/?movementId=${props.row.original.id}`} href={`/inventory/movement/detail/?movementId=${props.row.original.id}`}
variant='ghost' variant='ghost'
@@ -48,9 +39,8 @@ const RowOptionsMenu = ({
<Icon icon='mdi:eye-outline' width={16} height={16} /> <Icon icon='mdi:eye-outline' width={16} height={16} />
Detail Detail
</Button> </Button>
</div> </RowOptionsMenuWrapper>
); );
};
const MovementTable = () => { const MovementTable = () => {
const { const {
@@ -175,7 +165,7 @@ const MovementTable = () => {
{currentPageSize <= 2 && ( {currentPageSize <= 2 && (
<RowCollapseOptions> <RowCollapseOptions>
<RowOptionsMenu type='dropdown' props={props} /> <RowOptionsMenu type='collapse' props={props} />
</RowCollapseOptions> </RowCollapseOptions>
)} )}
</> </>
@@ -188,15 +178,16 @@ const MovementTable = () => {
<> <>
<div className='w-full p-0 sm:p-4'> <div className='w-full p-0 sm:p-4'>
<div className='flex flex-col gap-2 mb-4'> <div className='flex flex-col gap-2 mb-4'>
<div className='w-full flex flex-col xl:flex-row justify-between items-end xl:items-center gap-2'> <div className='w-full flex flex-col sm:flex-row justify-between items-end sm:items-center gap-2'>
<div className='w-full sm:w-fit flex flex-col sm:flex-row self-start gap-2'> <div className='w-full flex flex-row gap-2'>
<Button <Button
href='/inventory/movement/add' href='/inventory/movement/add'
variant='outline'
color='primary' color='primary'
className='w-full sm:w-fit' className='w-full sm:w-fit'
> >
<Icon icon='ic:round-plus' width={24} height={24} /> <Icon icon='ic:round-plus' width={24} height={24} />
Tambah Movement Tambah
</Button> </Button>
</div> </div>