UNPKG

polen

Version:

A framework for delightful GraphQL developer portals

21 lines 1 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { Pre } from 'codehike/code'; import React from 'react'; import PROJECT_DATA from 'virtual:polen/project/data.jsonsuper'; import { GraphQLInteractive } from './GraphQLInteractive/index.js'; /** * Code block component for Code Hike * Handles pre-highlighted code blocks and interactive GraphQL blocks */ export const CodeBlock = ({ codeblock }) => { // Check if this is an interactive GraphQL block if (codeblock.lang === 'graphql' && codeblock.meta?.includes('interactive')) { const schema = typeof window !== 'undefined' ? window.__POLEN_GRAPHQL_SCHEMA__ : null; return (_jsx(GraphQLInteractive, { codeblock: codeblock, schema: schema, showWarningIfNoSchema: PROJECT_DATA.warnings.interactiveWithoutSchema.enabled })); } // For regular code blocks, use Code Hike's Pre component with pre-highlighted code return _jsx(Pre, { code: codeblock }); }; //# sourceMappingURL=CodeBlock.js.map