Commit 4fdc348 1 parent 97835c5 commit 4fdc348 Copy full SHA for 4fdc348
File tree 5 files changed +39
-19
lines changed
packages/fern-docs/ui/src
5 files changed +39
-19
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ import {
22
22
useRef ,
23
23
} from "react" ;
24
24
import { FernErrorTag } from "../../components/FernErrorBoundary" ;
25
- import { PlaygroundButton } from "../../playground/PlaygroundButton " ;
25
+ import { PlaygroundButtonTray } from "../../playground/PlaygroundButtonTray " ;
26
26
import { usePlaygroundBaseUrl } from "../../playground/utils/select-environment" ;
27
27
import { AudioExample } from "../examples/AudioExample" ;
28
28
import {
@@ -216,13 +216,7 @@ const UnmemoizedEndpointContentCodeSnippets: React.FC<
216
216
</ >
217
217
) : undefined
218
218
}
219
- tryIt = {
220
- node != null ? (
221
- < >
222
- < PlaygroundButton state = { node } />
223
- </ >
224
- ) : undefined
225
- }
219
+ tryIt = { node != null ? < PlaygroundButtonTray state = { node } /> : undefined }
226
220
code = { resolveEnvironmentUrlInCodeSnippet (
227
221
endpoint ,
228
222
requestCodeSnippet ,
Original file line number Diff line number Diff line change @@ -85,11 +85,7 @@ export const TitledExample = forwardRef<
85
85
</ div >
86
86
</ div >
87
87
{ children }
88
- { tryIt ? (
89
- < div className = "border-card-border bg-tag-default-soft flex h-10 justify-end border-t p-2" >
90
- < div className = "flex max-w-[76px] items-center" > { tryIt } </ div >
91
- </ div >
92
- ) : undefined }
88
+ { tryIt }
93
89
</ div >
94
90
) ;
95
91
} ) ;
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import { WithAside } from "../../contexts/api-page";
20
20
import { useHref } from "../../hooks/useHref" ;
21
21
import { Markdown } from "../../mdx/Markdown" ;
22
22
import { PlaygroundButton } from "../../playground/PlaygroundButton" ;
23
+ import { PlaygroundButtonTray } from "../../playground/PlaygroundButtonTray" ;
23
24
import { usePlaygroundBaseUrl } from "../../playground/utils/select-environment" ;
24
25
import { getSlugFromChildren } from "../../util/getSlugFromText" ;
25
26
import { EndpointParameter } from "../endpoints/EndpointParameter" ;
@@ -375,7 +376,9 @@ const WebhookContent: FC<WebhookContentProps> = ({
375
376
< TitledExample
376
377
title = { "Handshake" }
377
378
tryIt = {
378
- node != null ? < PlaygroundButton state = { node } /> : undefined
379
+ node != null ? (
380
+ < PlaygroundButtonTray state = { node } />
381
+ ) : undefined
379
382
}
380
383
disableClipboard = { true }
381
384
>
Original file line number Diff line number Diff line change @@ -78,9 +78,11 @@ export function EndpointRequestSnippetInternal({
78
78
options = { endpoint . environments }
79
79
/>
80
80
}
81
+ // add the api reference button here to place correctly
81
82
languages = {
82
- availableLanguages . length > 1 ? (
83
- < >
83
+ < >
84
+ { slug != null ? < ApiReferenceButton slug = { slug } /> : undefined }
85
+ { availableLanguages . length > 1 ? (
84
86
< CodeExampleClientDropdown
85
87
languages = { availableLanguages }
86
88
onValueChange = { ( language ) =>
@@ -91,10 +93,9 @@ export function EndpointRequestSnippetInternal({
91
93
}
92
94
value = { selectedExampleKey . language }
93
95
/>
94
- </ >
95
- ) : undefined
96
+ ) : undefined }
97
+ </ >
96
98
}
97
- tryIt = { slug != null ? < ApiReferenceButton slug = { slug } /> : undefined }
98
99
code = { selectedExample . code }
99
100
language = { selectedExampleKey . language }
100
101
json = { EMPTY_OBJECT }
Original file line number Diff line number Diff line change
1
+ import * as FernNavigation from "@fern-api/fdr-sdk/navigation" ;
2
+ import { useAtomValue } from "jotai" ;
3
+ import { FC } from "react" ;
4
+ import { IS_PLAYGROUND_ENABLED_ATOM } from "../atoms" ;
5
+ import { usePlaygroundSettings } from "../hooks/usePlaygroundSettings" ;
6
+ import { PlaygroundButton } from "./PlaygroundButton" ;
7
+
8
+ export const PlaygroundButtonTray : FC < {
9
+ state : FernNavigation . NavigationNodeApiLeaf ;
10
+ className ?: string ;
11
+ } > = ( { state, className } ) => {
12
+ const isPlaygroundEnabled = useAtomValue ( IS_PLAYGROUND_ENABLED_ATOM ) ;
13
+ const settings = usePlaygroundSettings ( state . id ?? state ) ;
14
+
15
+ if ( ! isPlaygroundEnabled || settings ?. disabled ) {
16
+ return null ;
17
+ }
18
+
19
+ return (
20
+ < div className = "border-card-border bg-tag-default-soft flex h-10 justify-end border-t p-2" >
21
+ < div className = "flex max-w-[76px] items-center" >
22
+ < PlaygroundButton state = { state } className = { className } />
23
+ </ div >
24
+ </ div >
25
+ ) ;
26
+ } ;
You can’t perform that action at this time.
0 commit comments