|
1 | | -import { useState } from 'react'; |
| 1 | +import { LiveDemo } from './live-demo'; |
2 | 2 |
|
3 | 3 | export const metadata = { |
4 | 4 | title: 'Examples', |
5 | 5 | description: 'Examples of Mesh usage', |
6 | 6 | }; |
7 | 7 |
|
8 | | -export default function LiveDemo() { |
9 | | - const [exampleRepo, setExampleRepo] = useState('json-schema-example'); |
10 | | - return ( |
11 | | - <div className="min-h-[calc(100vh-var(--nextra-navbar-height))] flex flex-col"> |
12 | | - <div className="flex items-center justify-center gap-2 py-8"> |
13 | | - Choose Live Example: |
14 | | - <select |
15 | | - value={exampleRepo} |
16 | | - onChange={e => { |
17 | | - setExampleRepo(e.target.value); |
18 | | - }} |
19 | | - className="border rounded-md py-1.5" |
20 | | - > |
21 | | - {Object.entries(EXAMPLES).map(([groupName, group]) => ( |
22 | | - <optgroup key={groupName} label={groupName}> |
23 | | - {Object.entries(group).map(([exampleName, value]) => ( |
24 | | - <option key={exampleName} label={exampleName} value={value}> |
25 | | - {exampleName} |
26 | | - </option> |
27 | | - ))} |
28 | | - </optgroup> |
29 | | - ))} |
30 | | - </select> |
31 | | - </div> |
32 | | - <iframe |
33 | | - loading="lazy" |
34 | | - src={`https://codesandbox.io/embed/github/ardatan/graphql-mesh/tree/master/examples/${exampleRepo}?fontsize=14&hidenavigation=1&theme=dark&module=%2F.meshrc.yml`} |
35 | | - className="grow" |
36 | | - title={exampleRepo} |
37 | | - allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb" |
38 | | - sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin" |
39 | | - /> |
40 | | - </div> |
41 | | - ); |
| 8 | +export default function ExamplesPage() { |
| 9 | + return <LiveDemo />; |
42 | 10 | } |
43 | | - |
44 | | -export const EXAMPLES = { |
45 | | - OpenAPI: { |
46 | | - 'JavaScript Wiki': 'openapi-javascript-wiki', |
47 | | - 'Location Weather': 'openapi-location-weather', |
48 | | - YouTrack: 'openapi-youtrack', |
49 | | - Stripe: 'openapi-stripe', |
50 | | - StackExchange: 'openapi-stackexchange', |
51 | | - 'WeatherBit on React App': 'openapi-react-weatherbit', |
52 | | - 'NextJS with Apollo': 'nextjs-apollo-example', |
53 | | - }, |
54 | | - 'JSON Schema': { |
55 | | - 'Fake API': 'json-schema-example', |
56 | | - 'Covid-19 Statistics': 'json-schema-covid', |
57 | | - 'Subscriptions, Webhooks & Live Queries': 'json-schema-subscriptions', |
58 | | - }, |
59 | | - OData: { |
60 | | - TripPin: 'odata-trippin', |
61 | | - 'Microsoft Graph': 'odata-microsoft', |
62 | | - }, |
63 | | - SOAP: { |
64 | | - 'Country Info': 'soap-country-info', |
65 | | - }, |
66 | | - MySQL: { |
67 | | - Rfam: 'mysql-rfam', |
68 | | - }, |
69 | | - SQLite: { |
70 | | - Chinook: 'sqlite-chinook', |
71 | | - }, |
72 | | - 'Apollo Federation': { |
73 | | - 'Apollo Federation Example': 'federation-example', |
74 | | - }, |
75 | | - 'Apache Thrift': { |
76 | | - Calculator: 'thrift-calculator', |
77 | | - }, |
78 | | - gRPC: { |
79 | | - 'Movies Example': 'grpc-example', |
80 | | - }, |
81 | | - Neo4J: { |
82 | | - 'Movies Example': 'neo4j-example', |
83 | | - }, |
84 | | -}; |
0 commit comments