mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +01:00
chore: move website and guide out of packages
This commit is contained in:
15
apps/website/src/contexts/cmdK.tsx
Normal file
15
apps/website/src/contexts/cmdK.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
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);
|
||||
}
|
||||
16
apps/website/src/contexts/member.tsx
Normal file
16
apps/website/src/contexts/member.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { ApiItemJSON } from '@discordjs/api-extractor-utils';
|
||||
import { createContext, useContext, type ReactNode } from 'react';
|
||||
|
||||
export const MemberContext = createContext<ApiItemJSON | undefined>(undefined);
|
||||
|
||||
export const MemberProvider = ({
|
||||
member,
|
||||
children,
|
||||
}: {
|
||||
children?: ReactNode | undefined;
|
||||
member: ApiItemJSON | undefined;
|
||||
}) => <MemberContext.Provider value={member}>{children}</MemberContext.Provider>;
|
||||
|
||||
export function useMember() {
|
||||
return useContext(MemberContext);
|
||||
}
|
||||
Reference in New Issue
Block a user