Skip to content

Commit

Permalink
feat(app): add dropdown menu for actions
Browse files Browse the repository at this point in the history
  • Loading branch information
GeovannyGil committed Oct 4, 2024
1 parent a49182c commit e4f646c
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
35 changes: 35 additions & 0 deletions apps/app/src/components/links/actions-link.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@v1/ui/dropdown-menu";
import { Lucide } from "@v1/ui/lucide";
import { cn } from "@v1/ui/utils";

interface Props {
id: number;
className?: string;
}

const ActionsLink = ({ id, className }: Props) => {
return (
<DropdownMenu>
<DropdownMenuTrigger>
<button
className={cn(
"flex items-center justify-center py-1 px-1.5 rounded-lg hover:bg-neutral-50",
className,
)}
>
<Lucide.EllipsisVertical className="w-5 h-5" />
</button>
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuItem>Activar</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
);
};

export default ActionsLink;
11 changes: 9 additions & 2 deletions apps/app/src/components/links/card-link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { linkConstructor } from "@/lib/link-constructor";
import type { Tables } from "@v1/supabase/types";
import { CopyButton } from "@v1/ui/copy-button";
import { Lucide } from "@v1/ui/lucide";
import ActionsLink from "./actions-link";
import DateTooltip from "./date-tooltip";
import TagBadge, { type stateProps } from "./status-badge";
import CreatedByTooltip from "./user-tooltip";
Expand Down Expand Up @@ -113,11 +114,17 @@ const CardLink = ({
<TagBadge state={state as stateProps} />
<div className="overflow-hidden rounded-lg border border-gray-200 bg-gray-50 text-sm text-gray-800">
{/* Views */}
<div className="hidden items-center sm:flex gap-1 whitespace-nowrap px-1.5 py-0.5 transition-colors hover:bg-gray-100">
<div className="items-center flex gap-1 whitespace-nowrap px-1.5 py-0.5 transition-colors hover:bg-gray-100">
<Lucide.MousePointerClick className="w-4 h-4" />
<span className="text-sm font-medium">{views} views</span>
<span className="text-sm font-medium">
{views} <span className="hidden sm:inline">views</span>
</span>
</div>
</div>
<ActionsLink
className="border border-transparent group-hover/card:border-neutral-200 transition-[border] duration-200 ease-in-out"
id={id}
/>
</div>
</div>
</li>
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/components/lucide.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
CircleUser,
Copy,
CornerDownRight,
EllipsisVertical,
Eye,
EyeOff,
Link,
Expand Down Expand Up @@ -38,4 +39,5 @@ export const Lucide = {
JsonIcon: Braces,
MousePointerClick,
RefreshCcw,
EllipsisVertical,
};

0 comments on commit e4f646c

Please sign in to comment.