mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
16 lines
486 B
TypeScript
16 lines
486 B
TypeScript
import { type DisclosureState, useDialogState } from 'ariakit';
|
|
import type { PropsWithChildren } from 'react';
|
|
import { createContext, useContext } from 'react';
|
|
|
|
export const CmdKContext = createContext<DisclosureState | null>(null);
|
|
|
|
export const CmdKProvider = ({ children }: PropsWithChildren) => {
|
|
const dialog = useDialogState();
|
|
|
|
return <CmdKContext.Provider value={dialog}>{children}</CmdKContext.Provider>;
|
|
};
|
|
|
|
export function useCmdK() {
|
|
return useContext(CmdKContext);
|
|
}
|