@theguild/components 7.2.0-alpha-20241101220642-0b6682d9cf4196529799e8ad0e38b83426590e93 → 8.0.0-alpha-20241103181355-82c3ab0bf3c837c17af89f22915ef2beef8f305b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-ME7V4BHY.js +10 -0
- package/dist/cn.d.mts +5 -0
- package/dist/cn.js +8 -0
- package/dist/components/anchor.d.mts +11 -0
- package/dist/components/anchor.js +30 -0
- package/dist/components/button.d.mts +13 -0
- package/dist/components/button.js +25 -0
- package/dist/components/call-to-action.d.mts +38 -0
- package/dist/components/call-to-action.js +42 -0
- package/dist/components/cards-colorful.d.mts +19 -0
- package/dist/components/cards-colorful.js +20 -0
- package/dist/components/cookies-consent.d.mts +7 -0
- package/dist/components/cookies-consent.js +48 -0
- package/dist/components/decorations/index.d.mts +11 -0
- package/dist/components/decorations/index.js +72 -0
- package/dist/components/feature-list.d.mts +9 -0
- package/dist/components/feature-list.js +41 -0
- package/dist/components/footer.d.mts +9 -0
- package/dist/components/footer.js +116 -0
- package/dist/components/get-your-api-game-right-section.d.mts +7 -0
- package/dist/components/get-your-api-game-right-section.js +122 -0
- package/dist/components/giscus.d.mts +6 -0
- package/dist/components/giscus.js +14 -0
- package/dist/components/guild-navbar-logo.d.mts +19 -0
- package/dist/components/guild-navbar-logo.js +62 -0
- package/dist/components/heading.d.mts +10 -0
- package/dist/components/heading.js +36 -0
- package/dist/components/hero-gradient.d.mts +9 -0
- package/dist/components/hero-gradient.js +82 -0
- package/dist/components/hero-illustration.d.mts +9 -0
- package/dist/components/hero-illustration.js +31 -0
- package/dist/components/hero-marketplace.d.mts +9 -0
- package/dist/components/hero-marketplace.js +78 -0
- package/dist/components/hero-video.d.mts +9 -0
- package/dist/components/hero-video.js +73 -0
- package/dist/components/hive-footer.d.mts +11 -0
- package/dist/components/hive-footer.js +252 -0
- package/dist/components/hive-navigation/graphql-conf-card.d.mts +9 -0
- package/dist/components/hive-navigation/graphql-conf-card.js +26 -0
- package/dist/components/hive-navigation/index.d.mts +55 -0
- package/dist/components/hive-navigation/index.js +392 -0
- package/dist/components/hive-navigation/navigation-menu.d.mts +23 -0
- package/dist/components/hive-navigation/navigation-menu.js +179 -0
- package/dist/components/icons/index.d.mts +6 -0
- package/dist/{chunk-XKCA3AB7.js → components/icons/index.js} +29 -266
- package/dist/components/image.d.mts +6 -0
- package/dist/components/image.js +8 -0
- package/dist/components/index.d.mts +44 -0
- package/dist/components/index.js +52 -0
- package/dist/components/info-card.d.mts +11 -0
- package/dist/components/info-card.js +20 -0
- package/dist/components/info-list.d.mts +9 -0
- package/dist/components/info-list.js +27 -0
- package/dist/components/legacy-package-cmd.d.mts +13 -0
- package/dist/components/legacy-package-cmd.js +54 -0
- package/dist/components/marketplace-list.d.mts +9 -0
- package/dist/components/marketplace-list.js +118 -0
- package/dist/components/marketplace-search.d.mts +9 -0
- package/dist/components/marketplace-search.js +111 -0
- package/dist/components/npm-badge.d.mts +7 -0
- package/dist/components/npm-badge.js +16 -0
- package/dist/components/schema-type.d.mts +9 -0
- package/dist/components/schema-type.js +80 -0
- package/dist/components/stud.d.mts +7 -0
- package/dist/components/stud.js +17 -0
- package/dist/components/tag.d.mts +13 -0
- package/dist/components/tag.js +26 -0
- package/dist/components/theme-switcher.d.mts +7 -0
- package/dist/components/theme-switcher.js +17 -0
- package/dist/components/tools-and-libraries-cards.d.mts +7 -0
- package/dist/components/tools-and-libraries-cards.js +442 -0
- package/dist/constants.d.mts +7 -0
- package/dist/constants.js +7 -0
- package/dist/helpers/render-slot.d.mts +3 -0
- package/dist/helpers/render-slot.js +21 -0
- package/dist/index.d.mts +64 -339
- package/dist/index.js +21 -3115
- package/dist/logos/index.d.mts +26 -0
- package/dist/{chunk-EWF5AT2G.js → logos/index.js} +68 -53
- package/dist/mdx-components.d.mts +5 -0
- package/dist/mdx-components.js +50 -0
- package/dist/products.d.mts +10 -5
- package/dist/products.js +230 -5
- package/dist/server/index.d.mts +5 -0
- package/dist/server/index.js +12 -0
- package/dist/server/next.config.d.mts +10 -0
- package/dist/server/next.config.js +107 -0
- package/dist/server/npm.d.mts +21 -0
- package/dist/server/npm.js +75 -0
- package/dist/server/package.json +1 -0
- package/dist/server/pages.d.mts +1 -0
- package/dist/server/pages.js +5 -0
- package/dist/server/underscore-redirects.d.mts +3 -0
- package/dist/server/underscore-redirects.js +40 -0
- package/dist/static/illustrations/marketplace-cube-bl.d.mts +2 -0
- package/dist/static/illustrations/marketplace-cube-br.d.mts +2 -0
- package/dist/static/illustrations/marketplace-cube-tl.d.mts +2 -0
- package/dist/static/illustrations/marketplace-cube-tr.d.mts +2 -0
- package/dist/static/illustrations/marketplace-desktop.d.mts +2 -0
- package/dist/static/illustrations/marketplace-mobile.d.mts +2 -0
- package/dist/theme-layout.d.mts +39 -0
- package/dist/theme-layout.js +145 -0
- package/dist/types/components.d.mts +121 -0
- package/dist/types/components.js +0 -0
- package/package.json +19 -36
- package/style.css +10 -8
- package/dist/compile.mjs +0 -11
- package/dist/index.css +0 -133
- package/dist/logos.d.mts +0 -32
- package/dist/logos.js +0 -54
- package/dist/next.config.mjs +0 -135
- /package/dist/{marketplace-cube-bl-42X7Y3KO.png → static/illustrations/marketplace-cube-bl.png} +0 -0
- /package/dist/{marketplace-cube-br-Y5MZRDIL.png → static/illustrations/marketplace-cube-br.png} +0 -0
- /package/dist/{marketplace-cube-tl-PEJKW6RX.png → static/illustrations/marketplace-cube-tl.png} +0 -0
- /package/dist/{marketplace-cube-tr-O5XQ6Q4N.png → static/illustrations/marketplace-cube-tr.png} +0 -0
- /package/dist/{marketplace-desktop-7XUR54PR.png → static/illustrations/marketplace-desktop.png} +0 -0
- /package/dist/{marketplace-mobile-DI462WKF.png → static/illustrations/marketplace-mobile.png} +0 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useMemo, useState } from "react";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import ReactPaginate from "react-paginate";
|
|
6
|
+
import { Anchor } from "./anchor";
|
|
7
|
+
import { CaretSlimIcon } from "./icons";
|
|
8
|
+
import { Image } from "./image";
|
|
9
|
+
import { Tag, TagsContainer } from "./tag";
|
|
10
|
+
const formatDate = (value) => {
|
|
11
|
+
const months = [
|
|
12
|
+
"Jan",
|
|
13
|
+
"Feb",
|
|
14
|
+
"Mar",
|
|
15
|
+
"Apr",
|
|
16
|
+
"May",
|
|
17
|
+
"Jun",
|
|
18
|
+
"Jul",
|
|
19
|
+
"Aug",
|
|
20
|
+
"Sep",
|
|
21
|
+
"Oct",
|
|
22
|
+
"Nov",
|
|
23
|
+
"Dec"
|
|
24
|
+
];
|
|
25
|
+
const date = new Date(value);
|
|
26
|
+
return `${months[date.getMonth()]} ${date.getDate()}, ${date.getFullYear()}`;
|
|
27
|
+
};
|
|
28
|
+
const TableBody = ({ items = [] }) => /* @__PURE__ */ jsx("tbody", { children: items.map((item) => /* @__PURE__ */ jsxs(
|
|
29
|
+
"tr",
|
|
30
|
+
{
|
|
31
|
+
className: "border-0 border-b border-solid border-gray-300 text-xs font-medium text-gray-500 last:border-0 dark:border-gray-800 dark:text-gray-400",
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ jsx("td", { className: "w-14 py-4 pr-2 align-top md:w-20", children: item.image && /* @__PURE__ */ jsx(Image, { ...item.image }) }),
|
|
34
|
+
/* @__PURE__ */ jsx("td", { className: "px-2 py-4", children: /* @__PURE__ */ jsxs(
|
|
35
|
+
Anchor,
|
|
36
|
+
{
|
|
37
|
+
...item.link,
|
|
38
|
+
className: clsx(
|
|
39
|
+
"text-gray-500 duration-150 ease-in-out hover:opacity-75 dark:text-gray-400",
|
|
40
|
+
item.link.className
|
|
41
|
+
),
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ jsx("h3", { className: "m-0 line-clamp-2 text-base font-bold text-black md:text-lg dark:text-white", children: item.title }),
|
|
44
|
+
/* @__PURE__ */ jsx("div", { className: "line-clamp-3", children: item.description }),
|
|
45
|
+
item.tags && item.tags.length > 0 && /* @__PURE__ */ jsx(TagsContainer, { children: item.tags.map((tagName) => /* @__PURE__ */ jsx(Tag, { children: tagName }, tagName)) })
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
) }),
|
|
49
|
+
/* @__PURE__ */ jsx("td", { className: "hidden px-2 py-4 md:table-cell", children: formatDate(item.update) }),
|
|
50
|
+
/* @__PURE__ */ jsx("td", { className: "py-4 pl-2", children: /* @__PURE__ */ jsx(
|
|
51
|
+
Anchor,
|
|
52
|
+
{
|
|
53
|
+
...item.link,
|
|
54
|
+
className: clsx(
|
|
55
|
+
"inline-block rounded-lg bg-gray-200 p-1.5 text-gray-800 hover:invert md:p-2.5 dark:bg-gray-700 dark:text-white",
|
|
56
|
+
item.link.className
|
|
57
|
+
),
|
|
58
|
+
children: /* @__PURE__ */ jsx(CaretSlimIcon, { className: "size-5 -rotate-90" })
|
|
59
|
+
}
|
|
60
|
+
) })
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
item.title
|
|
64
|
+
)) });
|
|
65
|
+
const MarketplaceList = ({
|
|
66
|
+
title,
|
|
67
|
+
placeholder,
|
|
68
|
+
items,
|
|
69
|
+
pagination,
|
|
70
|
+
className
|
|
71
|
+
}) => {
|
|
72
|
+
const [currentPage, setCurrentPage] = useState(0);
|
|
73
|
+
const pageSize = pagination || 5;
|
|
74
|
+
const pageCount = items ? Math.ceil(items.length / pageSize) : 1;
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
setCurrentPage(0);
|
|
77
|
+
}, [items]);
|
|
78
|
+
const pages = useMemo(() => {
|
|
79
|
+
const itemsCopy = [...items];
|
|
80
|
+
const pagesData = [];
|
|
81
|
+
while (itemsCopy.length > 0) {
|
|
82
|
+
pagesData.push(itemsCopy.splice(0, pageSize));
|
|
83
|
+
}
|
|
84
|
+
return pagesData;
|
|
85
|
+
}, [items, pageSize]);
|
|
86
|
+
return /* @__PURE__ */ jsxs("section", { className: clsx("w-full bg-white dark:bg-dark", className), children: [
|
|
87
|
+
title && /* @__PURE__ */ jsx("h2", { className: "mb-4 mt-0 text-xl font-bold text-black md:text-2xl dark:text-gray-50", children: title }),
|
|
88
|
+
pages[currentPage]?.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
89
|
+
/* @__PURE__ */ jsxs("table", { className: "w-full border-collapse", children: [
|
|
90
|
+
/* @__PURE__ */ jsx("thead", { className: "whitespace-nowrap px-2 text-left text-xs font-semibold uppercase text-gray-300 dark:text-gray-600", children: /* @__PURE__ */ jsxs("tr", { className: "border-0", children: [
|
|
91
|
+
/* @__PURE__ */ jsx("th", { className: "px-2" }),
|
|
92
|
+
/* @__PURE__ */ jsx("th", { className: "px-2", children: "Name" }),
|
|
93
|
+
/* @__PURE__ */ jsx("th", { className: "hidden px-2 md:table-cell", children: "Last Update" }),
|
|
94
|
+
/* @__PURE__ */ jsx("th", { className: "px-2" })
|
|
95
|
+
] }) }),
|
|
96
|
+
/* @__PURE__ */ jsx(TableBody, { items: pages[currentPage] })
|
|
97
|
+
] }),
|
|
98
|
+
pageCount > 1 && /* @__PURE__ */ jsx(
|
|
99
|
+
ReactPaginate,
|
|
100
|
+
{
|
|
101
|
+
pageCount,
|
|
102
|
+
forcePage: currentPage,
|
|
103
|
+
pageRangeDisplayed: 3,
|
|
104
|
+
marginPagesDisplayed: 1,
|
|
105
|
+
onPageChange: (page) => setCurrentPage(page.selected),
|
|
106
|
+
containerClassName: "flex justify-center gap-x-2",
|
|
107
|
+
previousClassName: "hidden",
|
|
108
|
+
nextClassName: "hidden",
|
|
109
|
+
pageLinkClassName: "\n text-sm\n bg-gray-200\n dark:text-gray-300\n dark:bg-gray-700\n rounded-lg\n select-none\n hover:opacity-70\n transition\n px-3.5\n py-2\n ",
|
|
110
|
+
activeLinkClassName: "invert"
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
] }) : /* @__PURE__ */ jsx("div", { className: "flex h-24 w-full items-center justify-center rounded-lg bg-gray-100 text-black dark:bg-gray-700 dark:text-gray-300", children: placeholder })
|
|
114
|
+
] });
|
|
115
|
+
};
|
|
116
|
+
export {
|
|
117
|
+
MarketplaceList
|
|
118
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { IMarketplaceSearchProps } from '../types/components.mjs';
|
|
3
|
+
import 'next/image';
|
|
4
|
+
import 'next/link';
|
|
5
|
+
import 'react-player';
|
|
6
|
+
|
|
7
|
+
declare const MarketplaceSearch: ({ title, tagsFilter, placeholder, primaryList, secondaryList, queryList, className, }: IMarketplaceSearchProps) => ReactElement;
|
|
8
|
+
|
|
9
|
+
export { MarketplaceSearch };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { isValidElement, useCallback, useMemo, useState } from "react";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import fuzzy from "fuzzy";
|
|
6
|
+
import { CloseIcon, SearchIcon } from "./icons";
|
|
7
|
+
import { MarketplaceList } from "./marketplace-list";
|
|
8
|
+
import { Tag, TagsContainer } from "./tag";
|
|
9
|
+
const renderQueryPlaceholder = (placeholder, query) => {
|
|
10
|
+
if (!query || isValidElement(placeholder)) {
|
|
11
|
+
return placeholder;
|
|
12
|
+
}
|
|
13
|
+
const subStrings = placeholder.split("{query}");
|
|
14
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
15
|
+
subStrings[0],
|
|
16
|
+
" ",
|
|
17
|
+
/* @__PURE__ */ jsxs("strong", { children: [
|
|
18
|
+
'"',
|
|
19
|
+
query,
|
|
20
|
+
'"'
|
|
21
|
+
] }),
|
|
22
|
+
" ",
|
|
23
|
+
subStrings[1]
|
|
24
|
+
] });
|
|
25
|
+
};
|
|
26
|
+
const MarketplaceSearch = ({
|
|
27
|
+
title,
|
|
28
|
+
tagsFilter,
|
|
29
|
+
placeholder,
|
|
30
|
+
primaryList,
|
|
31
|
+
secondaryList,
|
|
32
|
+
queryList,
|
|
33
|
+
className
|
|
34
|
+
}) => {
|
|
35
|
+
const [query, setQuery] = useState("");
|
|
36
|
+
const handleChange = useCallback((e) => {
|
|
37
|
+
setQuery(e.currentTarget.value);
|
|
38
|
+
}, []);
|
|
39
|
+
const handleTagClick = (tagName) => {
|
|
40
|
+
if (query.includes(`#${tagName}`)) {
|
|
41
|
+
setQuery(query.replace(`#${tagName}`, "").trim());
|
|
42
|
+
} else {
|
|
43
|
+
setQuery((prev) => `${prev} #${tagName}`);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const items = useMemo(() => {
|
|
47
|
+
if (query && queryList) {
|
|
48
|
+
const tags = query.split(/\s+/).filter((e) => e.startsWith("#")).map((e) => e.replace("#", ""));
|
|
49
|
+
let filteredItems = queryList.items;
|
|
50
|
+
if (tags.length > 0) {
|
|
51
|
+
filteredItems = queryList.items.filter((item) => tags.every((e) => item.tags?.includes(e)));
|
|
52
|
+
}
|
|
53
|
+
const matchedResults = fuzzy.filter(
|
|
54
|
+
// Removes tags and all special characters from the query string for better fuzzy matching
|
|
55
|
+
// query
|
|
56
|
+
query.replace(/#\w+/gi, "").replace(/[^\w\s]/gi, "").trim(),
|
|
57
|
+
// Mapping the queryList items into a list of strings including the titles
|
|
58
|
+
filteredItems.map((e) => e.title)
|
|
59
|
+
).map((e) => e.original.toLowerCase());
|
|
60
|
+
return queryList.items.filter((e) => matchedResults.includes(e.title.toLowerCase()));
|
|
61
|
+
}
|
|
62
|
+
}, [query, queryList]);
|
|
63
|
+
return /* @__PURE__ */ jsx("section", { className: clsx("bg-white dark:bg-dark", className), children: /* @__PURE__ */ jsxs("div", { className: "container max-w-[90rem] py-12", children: [
|
|
64
|
+
/* @__PURE__ */ jsx("h2", { className: "mb-4 mt-0 text-2xl font-bold text-black md:text-3xl dark:text-gray-50", children: title }),
|
|
65
|
+
tagsFilter && /* @__PURE__ */ jsx(TagsContainer, { children: tagsFilter.map((tagName) => /* @__PURE__ */ jsx(
|
|
66
|
+
Tag,
|
|
67
|
+
{
|
|
68
|
+
selected: query.includes(`#${tagName}`),
|
|
69
|
+
onClick: () => handleTagClick(tagName),
|
|
70
|
+
children: tagName
|
|
71
|
+
},
|
|
72
|
+
tagName
|
|
73
|
+
)) }),
|
|
74
|
+
/* @__PURE__ */ jsxs("div", { className: "flex border-0 border-b border-solid border-gray-300 pb-3 dark:border-gray-800", children: [
|
|
75
|
+
/* @__PURE__ */ jsx(SearchIcon, { className: "text-gray-500 dark:text-white" }),
|
|
76
|
+
/* @__PURE__ */ jsx(
|
|
77
|
+
"input",
|
|
78
|
+
{
|
|
79
|
+
value: query,
|
|
80
|
+
type: "search",
|
|
81
|
+
placeholder,
|
|
82
|
+
onChange: handleChange,
|
|
83
|
+
className: "ml-1.5 mt-0.5 w-full border-0 bg-white text-sm font-medium text-black outline-none dark:bg-dark dark:text-gray-50"
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
/* @__PURE__ */ jsx(
|
|
87
|
+
"button",
|
|
88
|
+
{
|
|
89
|
+
onClick: () => setQuery(""),
|
|
90
|
+
className: "text-gray-300 hover:text-gray-700 dark:hover:text-white",
|
|
91
|
+
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
] }),
|
|
95
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-10 py-6 lg:flex-nowrap", children: items && queryList ? /* @__PURE__ */ jsx(
|
|
96
|
+
MarketplaceList,
|
|
97
|
+
{
|
|
98
|
+
title: queryList.title,
|
|
99
|
+
items,
|
|
100
|
+
placeholder: renderQueryPlaceholder(queryList.placeholder, query),
|
|
101
|
+
pagination: queryList.pagination
|
|
102
|
+
}
|
|
103
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
104
|
+
/* @__PURE__ */ jsx(MarketplaceList, { ...primaryList }),
|
|
105
|
+
secondaryList && /* @__PURE__ */ jsx(MarketplaceList, { ...secondaryList })
|
|
106
|
+
] }) })
|
|
107
|
+
] }) });
|
|
108
|
+
};
|
|
109
|
+
export {
|
|
110
|
+
MarketplaceSearch
|
|
111
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Anchor } from "./anchor";
|
|
3
|
+
const NPMBadge = ({ name }) => {
|
|
4
|
+
const encodedPackage = encodeURIComponent(name);
|
|
5
|
+
return /* @__PURE__ */ jsx(Anchor, { href: `https://npmjs.com/package/${encodedPackage}`, newWindow: true, children: /* @__PURE__ */ jsx(
|
|
6
|
+
"img",
|
|
7
|
+
{
|
|
8
|
+
src: `https://badge.fury.io/js/${encodedPackage}.svg`,
|
|
9
|
+
alt: "npm version",
|
|
10
|
+
className: "h-6"
|
|
11
|
+
}
|
|
12
|
+
) });
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
NPMBadge
|
|
16
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ISchemaPageProps } from '../types/components.mjs';
|
|
3
|
+
import 'next/image';
|
|
4
|
+
import 'next/link';
|
|
5
|
+
import 'react-player';
|
|
6
|
+
|
|
7
|
+
declare const SchemaPage: ({ schemaName, tags, editorData, }: ISchemaPageProps) => ReactElement;
|
|
8
|
+
|
|
9
|
+
export { SchemaPage };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { buildSchema } from "graphql";
|
|
5
|
+
import { ExecutableDocumentEditor, SchemaEditor } from "@theguild/editor";
|
|
6
|
+
import { CaretSlimIcon, MoreIcon, ShareIcon } from "./icons";
|
|
7
|
+
import { Image } from "./image";
|
|
8
|
+
import { Tag, TagsContainer } from "./tag";
|
|
9
|
+
const Editor = ({
|
|
10
|
+
title,
|
|
11
|
+
frameworks = [],
|
|
12
|
+
image,
|
|
13
|
+
children
|
|
14
|
+
}) => {
|
|
15
|
+
return /* @__PURE__ */ jsxs("div", { className: "min-w-full max-w-full pr-px lg:min-w-[25%] lg:max-w-[25%]", children: [
|
|
16
|
+
/* @__PURE__ */ jsxs("div", { className: "flex h-[85px] items-center justify-between bg-gray-100 p-3.5 dark:bg-transparent", children: [
|
|
17
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5", children: [
|
|
18
|
+
image && /* @__PURE__ */ jsx(Image, { src: image, alt: "logo", className: "size-14" }),
|
|
19
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
20
|
+
title && /* @__PURE__ */ jsx("p", { className: "text-sm dark:text-gray-50", children: title }),
|
|
21
|
+
frameworks.length > 0 && /* @__PURE__ */ jsx("span", { className: "text-sm dark:text-gray-50", children: frameworks.map((name) => /* @__PURE__ */ jsx(
|
|
22
|
+
"span",
|
|
23
|
+
{
|
|
24
|
+
className: "before:mx-1.5 before:content-['\u2022'] before:first-of-type:hidden",
|
|
25
|
+
children: name
|
|
26
|
+
},
|
|
27
|
+
name
|
|
28
|
+
)) })
|
|
29
|
+
] })
|
|
30
|
+
] }),
|
|
31
|
+
/* @__PURE__ */ jsx(Button, { children: /* @__PURE__ */ jsx(CaretSlimIcon, { className: "size-4" }) })
|
|
32
|
+
] }),
|
|
33
|
+
children
|
|
34
|
+
] });
|
|
35
|
+
};
|
|
36
|
+
const Button = ({ children }) => {
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
38
|
+
"button",
|
|
39
|
+
{
|
|
40
|
+
type: "button",
|
|
41
|
+
className: "rounded-md bg-gray-300 p-3 text-black transition hover:opacity-70",
|
|
42
|
+
children
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
const SchemaPage = ({
|
|
47
|
+
schemaName,
|
|
48
|
+
tags = [],
|
|
49
|
+
editorData
|
|
50
|
+
}) => {
|
|
51
|
+
const [schemaObj, setSchemaObj] = useState(() => buildSchema(editorData[0].schema));
|
|
52
|
+
return /* @__PURE__ */ jsxs("section", { className: "w-full bg-white dark:bg-dark", children: [
|
|
53
|
+
/* @__PURE__ */ jsxs("div", { className: "container flex max-w-[90rem] flex-col justify-between py-6 md:flex-row md:gap-16", children: [
|
|
54
|
+
/* @__PURE__ */ jsxs("span", { className: "pb-6 md:pb-0", children: [
|
|
55
|
+
/* @__PURE__ */ jsx("h2", { className: "mb-4 mt-0 text-xl font-bold text-black md:text-2xl dark:text-gray-50", children: schemaName }),
|
|
56
|
+
/* @__PURE__ */ jsx(TagsContainer, { children: tags.map((tagName) => /* @__PURE__ */ jsx(Tag, { children: tagName }, tagName)) })
|
|
57
|
+
] }),
|
|
58
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-start gap-2.5", children: [
|
|
59
|
+
/* @__PURE__ */ jsx(Button, { children: /* @__PURE__ */ jsx(ShareIcon, {}) }),
|
|
60
|
+
/* @__PURE__ */ jsx(Button, { children: /* @__PURE__ */ jsx(MoreIcon, {}) })
|
|
61
|
+
] })
|
|
62
|
+
] }),
|
|
63
|
+
/* @__PURE__ */ jsxs("div", { className: "flex", children: [
|
|
64
|
+
/* @__PURE__ */ jsx(Editor, { ...editorData[0], children: /* @__PURE__ */ jsx(
|
|
65
|
+
SchemaEditor,
|
|
66
|
+
{
|
|
67
|
+
schema: editorData[0].schema,
|
|
68
|
+
onSchemaChange: (newSchemaObject) => {
|
|
69
|
+
setSchemaObj(newSchemaObject);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
) }),
|
|
73
|
+
/* @__PURE__ */ jsx(Editor, { ...editorData[1], children: /* @__PURE__ */ jsx(ExecutableDocumentEditor, { schema: schemaObj, defaultValue: editorData[1].operations }) }),
|
|
74
|
+
editorData.slice(2).map((data) => /* @__PURE__ */ createElement(Editor, { ...data, key: data.title }, /* @__PURE__ */ jsx(SchemaEditor, { schema: data.schema })))
|
|
75
|
+
] })
|
|
76
|
+
] });
|
|
77
|
+
};
|
|
78
|
+
export {
|
|
79
|
+
SchemaPage
|
|
80
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../cn";
|
|
3
|
+
function Stud(props) {
|
|
4
|
+
return /* @__PURE__ */ jsx(
|
|
5
|
+
"div",
|
|
6
|
+
{
|
|
7
|
+
...props,
|
|
8
|
+
className: cn(
|
|
9
|
+
"w-fit rounded-lg bg-[linear-gradient(135deg,#68A8B6,#3B736A)] p-[9px] text-white",
|
|
10
|
+
props.className
|
|
11
|
+
)
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
Stud
|
|
17
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode, ReactElement } from 'react';
|
|
3
|
+
|
|
4
|
+
declare const Tag: ({ children, selected, onClick, }: {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
selected?: boolean;
|
|
7
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
8
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
9
|
+
declare const TagsContainer: ({ children }: {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}) => ReactElement;
|
|
12
|
+
|
|
13
|
+
export { Tag, TagsContainer };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
const Tag = ({
|
|
4
|
+
children,
|
|
5
|
+
selected,
|
|
6
|
+
onClick
|
|
7
|
+
}) => {
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
"button",
|
|
10
|
+
{
|
|
11
|
+
className: clsx(
|
|
12
|
+
"mb-2 mr-2 inline cursor-pointer rounded-md border-0 px-2 py-1 text-xs outline-none",
|
|
13
|
+
selected ? "bg-gray-400 text-gray-700" : "bg-gray-200 text-gray-500"
|
|
14
|
+
),
|
|
15
|
+
onClick,
|
|
16
|
+
children
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
const TagsContainer = ({ children }) => {
|
|
21
|
+
return /* @__PURE__ */ jsx("div", { className: "flex flex-wrap py-2", children });
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
Tag,
|
|
25
|
+
TagsContainer
|
|
26
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useTheme } from "nextra-theme-docs";
|
|
4
|
+
const ThemeSwitcherButton = ({ children }) => {
|
|
5
|
+
const { resolvedTheme, setTheme } = useTheme();
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
"button",
|
|
8
|
+
{
|
|
9
|
+
onClick: () => setTheme(resolvedTheme === "light" ? "dark" : "light"),
|
|
10
|
+
className: "self-center rounded-sm p-2 outline-none focus-visible:ring",
|
|
11
|
+
children
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
ThemeSwitcherButton
|
|
17
|
+
};
|