Skip to content

Commit

Permalink
fix: do not render hidden ation buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
kewitz committed Dec 12, 2024
1 parent 7e2936b commit ee7e334
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions components/DrawerHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { MoreHorizontal, X } from 'lucide-react';
import { FormattedMessage } from 'react-intl';

import { useWindowResize, VIEWPORTS } from '../lib/hooks/useWindowResize';
import { cn } from '../lib/utils';

import { DropdownActionItem } from './table/RowActionsMenu';
import { Button } from './ui/Button';
Expand Down Expand Up @@ -49,22 +48,24 @@ export default function DrawerHeader({
<div className="flex items-center gap-2">{entityLabel}</div>

<div className="flex items-center gap-1">
<div className={cn('hidden items-center gap-1', { 'sm:flex': !forceMoreActions })}>
{primary?.map(action => (
<Button
key={action.key || action.label}
variant="outline"
size="xs"
className="gap-1.5"
onClick={action.onClick}
disabled={action.disabled}
data-cy={action['data-cy']}
>
{action.Icon && <action.Icon size={16} />}
<span>{action.label}</span>
</Button>
))}
</div>
{!forceMoreActions && (
<div className="items-center gap-1">
{primary?.map(action => (
<Button
key={action.key || action.label}
variant="outline"
size="xs"
className="gap-1.5"
onClick={action.onClick}
disabled={action.disabled}
data-cy={action['data-cy']}
>
{action.Icon && <action.Icon size={16} />}
<span>{action.label}</span>
</Button>
))}
</div>
)}
{hasMoreActions && (
<DropdownMenu>
<DropdownMenuTrigger asChild ref={dropdownTriggerRef}>
Expand Down

0 comments on commit ee7e334

Please sign in to comment.