UNPKG

gatsby-openrpc-theme

Version:

A gatsby theme for generated OpenRPC documentation

30 lines 1.11 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const react_1 = __importDefault(require("react")); const gatsby_plugin_image_1 = require("gatsby-plugin-image"); const gatsby_1 = require("gatsby"); const Image = ({ src, alt, className }) => { const data = (0, gatsby_1.useStaticQuery)((0, gatsby_1.graphql) ` query { allImageSharp { nodes { gatsbyImageData original { src } } } } `); const image = data.allImageSharp.nodes.find((node) => node.original.src.includes(src)); if (!image) { return react_1.default.createElement("img", { src: src, alt: alt, className: className }); } const gatsbyImage = (0, gatsby_plugin_image_1.getImage)(image); return react_1.default.createElement(gatsby_plugin_image_1.GatsbyImage, { image: gatsbyImage, alt: alt, className: className }); }; exports.default = Image; //# sourceMappingURL=image.js.map