refactor: update icons and improve action visibility in row and bulk action menus
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Fragment, memo } from 'react';
|
||||
import { Group, ActionIcon, Tooltip, Menu, Divider, Box, Button } from '@mantine/core';
|
||||
import { Group, ActionIcon, Tooltip, Menu, Divider, Box, Button, MantineSpacing } from '@mantine/core';
|
||||
import { RowActionProps } from './types';
|
||||
import { getIntentColor } from './utils';
|
||||
import { MoreVertical } from 'lucide-react';
|
||||
@@ -9,6 +9,8 @@ export interface RowActionsProps {
|
||||
actions: RowActionProps[];
|
||||
showLabels?: boolean;
|
||||
responsiveView?: boolean;
|
||||
gapActionDesktop?: MantineSpacing;
|
||||
gapActionMobile?: MantineSpacing;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -17,11 +19,9 @@ export interface RowActionsProps {
|
||||
*
|
||||
* @performance Wrapped in React.memo to guarantee zero overhead inside large lists/grids.
|
||||
*/
|
||||
export const RowActions = memo(function RowActions({
|
||||
actions = [],
|
||||
showLabels = false,
|
||||
responsiveView = true,
|
||||
}: RowActionsProps) {
|
||||
export const RowActions = memo(function RowActions(props: RowActionsProps) {
|
||||
const { actions = [], showLabels = false, responsiveView = true, gapActionDesktop = 0, gapActionMobile = 0 } = props;
|
||||
|
||||
/**
|
||||
* Helper function to render a standalone item.
|
||||
*/
|
||||
@@ -114,14 +114,14 @@ export const RowActions = memo(function RowActions({
|
||||
return (
|
||||
<Box style={{ display: 'inline-flex' }}>
|
||||
{/* --- DESKTOP VIEW (hidden on mobile devices) --- */}
|
||||
<Group gap={0} wrap="nowrap" visibleFrom={responsiveView ? 'sm' : undefined}>
|
||||
<Group gap={gapActionDesktop} wrap="nowrap" visibleFrom={responsiveView ? 'sm' : undefined}>
|
||||
{renderFlatActions()}
|
||||
</Group>
|
||||
|
||||
{/* --- MOBILE VIEW (hidden on desktop devices) --- */}
|
||||
|
||||
{responsiveView && (
|
||||
<Group gap={0} wrap="nowrap" hiddenFrom="sm">
|
||||
<Group gap={gapActionMobile} wrap="nowrap" hiddenFrom="sm">
|
||||
<Menu position="bottom-end" withArrow withinPortal zIndex={9999}>
|
||||
<Menu.Target>
|
||||
<ActionIcon variant="transparent" size="md">
|
||||
|
||||
Reference in New Issue
Block a user