@bytebeans/macaw-ui
Version:
Saleor's UI component library
23 lines (17 loc) • 620 B
text/typescript
import { createContext, useContext } from "react";
export type ListActionContextType = (hover: boolean) => void;
export const ListActionContext = createContext<
ListActionContextType | undefined
>(undefined);
ListActionContext.displayName = "ListActionContext";
export const useListAction = () => {
const ctx = useContext(ListActionContext);
if (ctx === undefined) {
throw new Error("useListAction must be used within a ListActionContext");
}
return ctx;
};
export interface UseTableActionHover {
hover: boolean;
props: Record<"onMouseLeave" | "onMouseEnter", () => void>;
}