diff --git a/apps/web/components/booking/BookingListItem.tsx b/apps/web/components/booking/BookingListItem.tsx index 4c165a7663..0dc3a59d05 100644 --- a/apps/web/components/booking/BookingListItem.tsx +++ b/apps/web/components/booking/BookingListItem.tsx @@ -23,12 +23,12 @@ import { TextArea, Tooltip, } from "@calcom/ui"; +import { ActionType, TableActions } from "@calcom/ui"; import useMeQuery from "@lib/hooks/useMeQuery"; import { EditLocationDialog } from "@components/dialog/EditLocationDialog"; import { RescheduleDialog } from "@components/dialog/RescheduleDialog"; -import TableActions, { ActionType } from "@components/ui/TableActions"; type BookingListingStatus = RouterInputs["viewer"]["bookings"]["get"]["status"]; diff --git a/packages/ui/components/index.ts b/packages/ui/components/index.ts index d79b8dbbc0..bb1c224de7 100644 --- a/packages/ui/components/index.ts +++ b/packages/ui/components/index.ts @@ -29,3 +29,5 @@ export { } from "./form"; export { TopBanner } from "./top-banner"; export type { TopBannerProps } from "./top-banner"; +export { TableActions, DropdownActions } from "./table/TableActions"; +export type { ActionType } from "./table/TableActions"; diff --git a/apps/web/components/ui/TableActions.tsx b/packages/ui/components/table/TableActions.tsx similarity index 87% rename from apps/web/components/ui/TableActions.tsx rename to packages/ui/components/table/TableActions.tsx index 08352a8254..ff8f480444 100644 --- a/apps/web/components/ui/TableActions.tsx +++ b/packages/ui/components/table/TableActions.tsx @@ -1,4 +1,5 @@ import React, { FC } from "react"; +import { IconType } from "react-icons/lib"; import { Button, @@ -7,18 +8,17 @@ import { DropdownMenuItem, DropdownMenuPortal, DropdownMenuTrigger, + ButtonBaseProps, Icon, } from "@calcom/ui"; -import { SVGComponent } from "@lib/types/SVGComponent"; - export type ActionType = { id: string; - icon?: SVGComponent; + icon?: IconType; iconClassName?: string; label: string; disabled?: boolean; - color?: "primary" | "secondary"; + color?: ButtonBaseProps["color"]; } & ( | { href: string; onClick?: never; actions?: never } | { href?: never; onClick: (e: React.MouseEvent) => void; actions?: never } @@ -33,7 +33,7 @@ const defaultAction = (e: React.MouseEvent) => { e.stopPropagation(); }; -const DropdownActions = ({ +export const DropdownActions = ({ actions, actionTrigger, }: { @@ -52,10 +52,10 @@ const DropdownActions = ({ {actions.map((action) => ( - +