mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-09 12:27:43 +00:00
docs: remove copy button from disabled code blocks (#4516)
This commit is contained in:
committed by
GitHub
parent
a7eaa049e4
commit
6e60de4205
@@ -144,6 +144,7 @@ export const APIMethod = ({
|
|||||||
noResult ? "" : `const ${resultVariable} = `
|
noResult ? "" : `const ${resultVariable} = `
|
||||||
}await auth.api.${functionName}(${serverBody});${code_suffix}`}
|
}await auth.api.${functionName}(${serverBody});${code_suffix}`}
|
||||||
lang="ts"
|
lang="ts"
|
||||||
|
allowCopy={!isClientOnly}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -243,6 +244,7 @@ export const APIMethod = ({
|
|||||||
}, error } = `
|
}, error } = `
|
||||||
}await authClient.${authClientMethodPath}(${clientBody});${code_suffix}`}
|
}await authClient.${authClientMethodPath}(${clientBody});${code_suffix}`}
|
||||||
lang="ts"
|
lang="ts"
|
||||||
|
allowCopy={!isServerOnly}
|
||||||
/>
|
/>
|
||||||
{isServerOnly ? (
|
{isServerOnly ? (
|
||||||
<div className="flex absolute inset-0 justify-center items-center w-full h-full rounded-lg border backdrop-brightness-50 backdrop-blur-xs border-border">
|
<div className="flex absolute inset-0 justify-center items-center w-full h-full rounded-lg border backdrop-brightness-50 backdrop-blur-xs border-border">
|
||||||
|
|||||||
@@ -34,6 +34,12 @@ export interface DynamicCodeblockProps {
|
|||||||
* @defaultValue true
|
* @defaultValue true
|
||||||
*/
|
*/
|
||||||
wrapInSuspense?: boolean;
|
wrapInSuspense?: boolean;
|
||||||
|
/**
|
||||||
|
* Allow to copy code with copy button
|
||||||
|
*
|
||||||
|
* @defaultValue true
|
||||||
|
*/
|
||||||
|
allowCopy?: boolean;
|
||||||
options?: Omit<HighlightOptionsCommon, "lang"> & HighlightOptionsThemes;
|
options?: Omit<HighlightOptionsCommon, "lang"> & HighlightOptionsThemes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,6 +69,7 @@ export function DynamicCodeBlock({
|
|||||||
codeblock,
|
codeblock,
|
||||||
options,
|
options,
|
||||||
wrapInSuspense = true,
|
wrapInSuspense = true,
|
||||||
|
allowCopy = true,
|
||||||
}: DynamicCodeblockProps) {
|
}: DynamicCodeblockProps) {
|
||||||
const shikiOptions = {
|
const shikiOptions = {
|
||||||
lang,
|
lang,
|
||||||
@@ -85,7 +92,9 @@ export function DynamicCodeBlock({
|
|||||||
</Suspense>
|
</Suspense>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <PropsContext value={codeblock}>{children}</PropsContext>;
|
return (
|
||||||
|
<PropsContext value={{ ...codeblock, allowCopy }}>{children}</PropsContext>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Placeholder({
|
function Placeholder({
|
||||||
|
|||||||
Reference in New Issue
Block a user