Skip to content

Commit 6fbd634

Browse files
committed
📝 added docs
1 parent 0b0ebee commit 6fbd634

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+9183
-5
lines changed

.github/workflows/landing.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
jobs:
6+
deploy:
7+
runs-on: ubuntu-20.04
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: build
13+
run: npm run doc:ci
14+
env:
15+
PATH_PREFIX: /graphql-zeus
16+
- name: Deploy
17+
uses: peaceiris/actions-gh-pages@v3
18+
with:
19+
github_token: ${{ secrets.GITHUB_TOKEN }}
20+
publish_dir: ./doc/out

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
on:
22
push:
3-
branches:
4-
- master
3+
tags:
4+
- '[0-9]+.[0-9]+.[0-9]+'
55
jobs:
66
build:
77
runs-on: ubuntu-latest

doc/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PATH_PREFIX=

doc/.purplehaze/Layout/index.js

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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+
};

doc/.purplehaze/index.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// src/index.tsx
2+
import React from "https://cdn.skypack.dev/react";
3+
import {htmlContent} from "./ssg/markdown.js";
4+
import {Layout} from "./Layout/index.js";
5+
import {routes} from "./markdownRoutes.js";
6+
import {renderMarkdown} from "./mdtransform.js";
7+
var src_default = (data2) => {
8+
return /* @__PURE__ */ React.createElement(Layout, {
9+
prefix: data2.prefix,
10+
routes: data2.routes
11+
}, /* @__PURE__ */ React.createElement("div", {
12+
className: "prose prose-lg",
13+
dangerouslySetInnerHTML: {
14+
__html: renderMarkdown.render(data2.content.content)
15+
}
16+
}));
17+
};
18+
var data = () => {
19+
return {
20+
content: htmlContent["markdown/index.md"],
21+
routes: routes(htmlContent),
22+
prefix: ssg.envs.PATH_PREFIX
23+
};
24+
};
25+
var head = () => {
26+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("link", {
27+
rel: "stylesheet",
28+
href: "./tw.css"
29+
}), /* @__PURE__ */ React.createElement("title", null, "GraphQL Zeus docs 0.0.7"));
30+
};
31+
export {
32+
data,
33+
src_default as default,
34+
head
35+
};

doc/.purplehaze/markdownRoutes.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// src/markdownRoutes.ts
2+
var routes = (htmlContent) => Object.entries(htmlContent).filter(([, v]) => !!v.data.title).map(([k, v]) => ({
3+
...v.data
4+
})).sort((a, b) => ("order" in a ? a.order : 0) > ("order" in b ? b.order : 0) ? 1 : -1);
5+
export {
6+
routes
7+
};

doc/.purplehaze/mdtransform.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// src/mdtransform.ts
2+
import hljs from "https://cdn.skypack.dev/highlight.js";
3+
import {Remarkable} from "https://cdn.skypack.dev/remarkable";
4+
var renderMarkdown = new Remarkable({
5+
highlight: function(str, lang) {
6+
if (lang && hljs.getLanguage(lang)) {
7+
try {
8+
return hljs.highlight(lang, str).value;
9+
} catch (__) {
10+
}
11+
}
12+
try {
13+
return hljs.highlightAuto(str).value;
14+
} catch (__) {
15+
}
16+
return "";
17+
}
18+
});
19+
export {
20+
renderMarkdown
21+
};

doc/.purplehaze/page.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// src/page.tsx
2+
import React from "https://cdn.skypack.dev/react";
3+
import {htmlContent} from "./ssg/markdown.js";
4+
import {Layout} from "./Layout/index.js";
5+
import {routes} from "./markdownRoutes.js";
6+
import {renderMarkdown} from "./mdtransform.js";
7+
var CustomPage = ({data: data2}) => {
8+
return /* @__PURE__ */ React.createElement(Layout, {
9+
prefix: data2.prefix,
10+
activeRoute: data2.activeRoute,
11+
routes: data2.routes
12+
}, /* @__PURE__ */ React.createElement("div", {
13+
className: "prose prose-lg",
14+
dangerouslySetInnerHTML: {
15+
__html: renderMarkdown.render(data2.content.content)
16+
}
17+
}));
18+
};
19+
var data = () => {
20+
return {
21+
htmlContent,
22+
routes: routes(htmlContent),
23+
prefix: ssg.envs.PATH_PREFIX
24+
};
25+
};
26+
var page_default = (staticData) => {
27+
return /* @__PURE__ */ React.createElement(CustomPage, {
28+
data: staticData
29+
});
30+
};
31+
var pages = async (staticData) => {
32+
return await Promise.all(Object.entries(staticData.htmlContent).filter(([, v]) => !!v.data.link).map(async ([k, v], i) => {
33+
return {
34+
data: {
35+
content: v,
36+
routes: routes(staticData.htmlContent),
37+
activeRoute: v.data.link,
38+
prefix: staticData.prefix
39+
},
40+
slug: v.data.link,
41+
head: `
42+
<link
43+
rel="stylesheet"
44+
href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.2.0/build/styles/github-dark.min.css"
45+
/>
46+
<link rel="stylesheet" href="/tw.css" />
47+
<title>GraphQL Zeus docs</title>
48+
`
49+
};
50+
}));
51+
};
52+
export {
53+
data,
54+
page_default as default,
55+
pages
56+
};

0 commit comments

Comments
 (0)