|
| 1 | +// src/Layout/index.tsx |
| 2 | +import React, {useState} from "https://cdn.skypack.dev/react"; |
| 3 | +var GithubIcon = () => /* @__PURE__ */ React.createElement("svg", { |
| 4 | + xmlns: "http://www.w3.org/2000/svg", |
| 5 | + width: "24", |
| 6 | + height: "24", |
| 7 | + viewBox: "0 0 24 24", |
| 8 | + fill: "none", |
| 9 | + stroke: "currentColor", |
| 10 | + "stroke-width": "2", |
| 11 | + "stroke-linecap": "round", |
| 12 | + "stroke-linejoin": "round" |
| 13 | +}, /* @__PURE__ */ React.createElement("path", { |
| 14 | + d: "M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22" |
| 15 | +})); |
| 16 | +var Layout = ({children, routes, activeRoute, prefix = ""}) => { |
| 17 | + const [mobileMenuOpen, setMobileMenuOpen] = useState(false); |
| 18 | + return /* @__PURE__ */ React.createElement("div", { |
| 19 | + className: "h-full flex flex-col" |
| 20 | + }, /* @__PURE__ */ React.createElement("div", { |
| 21 | + className: "w-full sm:flex hidden px-10 border-b border-purple-200 items-center" |
| 22 | + }, /* @__PURE__ */ React.createElement("a", { |
| 23 | + className: "block py-4 text-xl logo font-black", |
| 24 | + href: `${prefix}/` |
| 25 | + }, "GraphQL Zeus"), /* @__PURE__ */ React.createElement("span", { |
| 26 | + className: "text-gray-400 block ml-2 text-md mt-1" |
| 27 | + }, "Autocomplete client for GraphQL"), /* @__PURE__ */ React.createElement("span", { |
| 28 | + className: "ml-auto mr-2 text-gray-500" |
| 29 | + }, "4.0.4"), /* @__PURE__ */ React.createElement("a", { |
| 30 | + href: "https://github.com/graphql-editor/graphql-zeus", |
| 31 | + className: "text-purple-500", |
| 32 | + title: "Github repository" |
| 33 | + }, /* @__PURE__ */ React.createElement(GithubIcon, null))), /* @__PURE__ */ React.createElement("div", { |
| 34 | + className: "flex w-full flex-1 overflow-hidden" |
| 35 | + }, /* @__PURE__ */ React.createElement("div", { |
| 36 | + className: "absolute sm:hidden block cursor-pointer top-6 right-6", |
| 37 | + onClick: () => setMobileMenuOpen(!mobileMenuOpen) |
| 38 | + }, /* @__PURE__ */ React.createElement("div", { |
| 39 | + className: "h-2 w-10 bg-purple-500 mb-2 rounded" |
| 40 | + }), /* @__PURE__ */ React.createElement("div", { |
| 41 | + className: "h-2 w-10 bg-purple-500 mb-2 rounded" |
| 42 | + }), /* @__PURE__ */ React.createElement("div", { |
| 43 | + className: "h-2 w-10 bg-purple-500 mb-2 rounded" |
| 44 | + })), mobileMenuOpen && /* @__PURE__ */ React.createElement("div", { |
| 45 | + className: "py-10 px-20 bg-gray-100 h-full w-80 sm:hidden block absolute top-0 left-0" |
| 46 | + }, /* @__PURE__ */ React.createElement("a", { |
| 47 | + className: "block py-4 text-lg text-purple-900 font-black", |
| 48 | + href: `${prefix}/` |
| 49 | + }, "Purple haze"), routes.map((r) => /* @__PURE__ */ React.createElement("a", { |
| 50 | + className: `block py-3 text-md font-medium${activeRoute === r.link ? " text-purple-600" : "text-gray-600"}`, |
| 51 | + href: `${prefix}/page/${r.link}.html` |
| 52 | + }, r.title))), /* @__PURE__ */ React.createElement("div", { |
| 53 | + className: "py-6 px-10 w-80 sm:block hidden border-r border-purple-200" |
| 54 | + }, routes.map((r) => /* @__PURE__ */ React.createElement("a", { |
| 55 | + className: `transition-all block py-3 text-md font-medium${activeRoute === r.link ? " text-purple-600" : " text-gray-600 hover:text-purple-600"}`, |
| 56 | + href: `${prefix}/page/${r.link}.html` |
| 57 | + }, r.title))), /* @__PURE__ */ React.createElement("div", { |
| 58 | + className: "container mx-auto px-20 py-6 pb-20 h-full overflow-auto" |
| 59 | + }, children))); |
| 60 | +}; |
| 61 | +export { |
| 62 | + Layout |
| 63 | +}; |
0 commit comments