|
| 1 | +import { SpeakeasyCodeSamplesCore } from "@speakeasyapi/code-samples/core"; |
1 | 2 | import {
|
2 |
| - CodeSample, |
3 |
| - SpeakeasyCodeSamplesProvider, |
4 | 3 | CodeSampleFilenameTitle,
|
| 4 | + CodeSamplesViewer, |
| 5 | + SpeakeasyCodeSamplesProvider, |
5 | 6 | } from "@speakeasyapi/code-samples/react";
|
6 |
| -import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; |
7 | 7 | import "./App.css";
|
8 |
| -import { SpeakeasyCodeSamplesCore } from "@speakeasyapi/code-samples/core"; |
9 |
| -import { SpeakeasyCodeSamples } from "@speakeasyapi/code-samples"; |
10 | 8 |
|
11 | 9 | function App() {
|
12 |
| - console.log({ SpeakeasyCodeSamples }); |
13 |
| - |
14 |
| - const queryClient = new QueryClient(); |
15 | 10 | const coreSdk = new SpeakeasyCodeSamplesCore({
|
16 | 11 | apiKey: import.meta.env.VITE_SPEAKEASY_API_KEY,
|
17 | 12 | registryUrl: import.meta.env.VITE_SPEAKEASY_REGISTRY_URL,
|
18 | 13 | });
|
19 | 14 |
|
20 | 15 | return (
|
21 |
| - <QueryClientProvider client={queryClient}> |
22 |
| - <SpeakeasyCodeSamplesProvider client={coreSdk}> |
23 |
| - <h1 className="">Speakeasy Code Samples</h1> |
24 |
| - <div style={{ width: "100%", marginInline: "auto" }}> |
25 |
| - <CodeSample |
26 |
| - title={CodeSampleFilenameTitle} |
27 |
| - operation={"getPassageText"} |
28 |
| - /> |
29 |
| - </div> |
30 |
| - </SpeakeasyCodeSamplesProvider> |
31 |
| - </QueryClientProvider> |
| 16 | + <SpeakeasyCodeSamplesProvider client={coreSdk}> |
| 17 | + <h1 className="">Speakeasy Code Samples</h1> |
| 18 | + <div style={{ width: "50%", marginInline: "auto" }}> |
| 19 | + <CodeSamplesViewer |
| 20 | + copyable |
| 21 | + defaultLang={"typescript"} |
| 22 | + title={CodeSampleFilenameTitle} |
| 23 | + operation={"getPassageText"} |
| 24 | + /> |
| 25 | + </div> |
| 26 | + </SpeakeasyCodeSamplesProvider> |
32 | 27 | );
|
33 | 28 | }
|
34 | 29 |
|
|
0 commit comments