info-site-generator 1.0.91 → 1.0.92
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/lib/App.js +84 -70
- package/lib/components/ArrowBack.js +18 -10
- package/lib/components/Footer.js +46 -25
- package/lib/components/Navbar.js +85 -63
- package/lib/components/Wrapper.js +26 -14
- package/lib/index.js +1 -1
- package/lib/pages/Content.js +40 -23
- package/lib/pages/Home.js +98 -62
- package/lib/pages/Page.js +22 -8
- package/lib/pages/Search.js +62 -38
- package/lib/styles/styles.d.js +1 -0
- package/lib/theme.js +15 -7
- package/package.json +12 -2
package/lib/App.js
CHANGED
|
@@ -1,81 +1,95 @@
|
|
|
1
|
-
|
|
2
|
-
import Home from "./pages/Home";
|
|
3
|
-
import defaults from "./contentDefaults.json";
|
|
4
|
-
import { ThemeContext } from "./theme";
|
|
5
|
-
import Wrapper from "./components/Wrapper";
|
|
6
|
-
import "./index.css";
|
|
7
|
-
import Content from "./pages/Content";
|
|
8
|
-
import PageGen from "./pages/Page";
|
|
9
|
-
import Search from "./pages/Search";
|
|
10
|
-
import React from "react";
|
|
1
|
+
"use strict";
|
|
11
2
|
|
|
12
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactRouter = require("react-router");
|
|
8
|
+
var _Home = _interopRequireDefault(require("./pages/Home"));
|
|
9
|
+
var _contentDefaults = _interopRequireDefault(require("./contentDefaults.json"));
|
|
10
|
+
var _theme = require("./theme");
|
|
11
|
+
var _Wrapper = _interopRequireDefault(require("./components/Wrapper"));
|
|
12
|
+
require("./index.css");
|
|
13
|
+
var _Content = _interopRequireDefault(require("./pages/Content"));
|
|
14
|
+
var _Page = _interopRequireDefault(require("./pages/Page"));
|
|
15
|
+
var _Search = _interopRequireDefault(require("./pages/Search"));
|
|
16
|
+
var _react = _interopRequireDefault(require("react"));
|
|
17
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
22
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
23
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
|
|
13
24
|
* The info site generator main component
|
|
14
25
|
* @returns A ready app based on the data provided
|
|
15
26
|
*/
|
|
16
|
-
function SiteGen({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
...data_provided
|
|
23
|
-
};
|
|
27
|
+
function SiteGen(_ref) {
|
|
28
|
+
let {
|
|
29
|
+
data_provided,
|
|
30
|
+
children
|
|
31
|
+
} = _ref;
|
|
32
|
+
const validData = _objectSpread(_objectSpread({}, _contentDefaults.default), data_provided);
|
|
24
33
|
Object.values(validData.pages).forEach(page => {
|
|
25
|
-
|
|
34
|
+
var _page$withLink;
|
|
35
|
+
page.withLink = (_page$withLink = page.withLink) !== null && _page$withLink !== void 0 ? _page$withLink : true;
|
|
26
36
|
// page.withLink = page.withLink === undefined ? false : page.withLink;
|
|
27
37
|
});
|
|
28
|
-
return /*#__PURE__*/
|
|
29
|
-
value: localStorage.getItem("theme") || "light"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
38
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_theme.ThemeContext.Provider, {
|
|
39
|
+
value: localStorage.getItem("theme") || "light",
|
|
40
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouter.HashRouter, {
|
|
41
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactRouter.Routes, {
|
|
42
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouter.Route, {
|
|
43
|
+
index: true,
|
|
44
|
+
element: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Wrapper.default, {
|
|
45
|
+
data: validData,
|
|
46
|
+
component: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Home.default, {
|
|
47
|
+
data: validData
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouter.Route, {
|
|
51
|
+
path: "all-content",
|
|
52
|
+
element: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Wrapper.default, {
|
|
53
|
+
data: validData,
|
|
54
|
+
component: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Content.default, {
|
|
55
|
+
data: validData
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouter.Route, {
|
|
59
|
+
path: "search",
|
|
60
|
+
element: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Wrapper.default, {
|
|
61
|
+
data: validData,
|
|
62
|
+
component: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Search.default, {
|
|
63
|
+
data: validData
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
}), _react.default.Children.map(children, child => {
|
|
67
|
+
// Check if it's a valid React element (not a string or null)
|
|
68
|
+
if (! /*#__PURE__*/_react.default.isValidElement(child)) return null;
|
|
57
69
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
70
|
+
// Tell TS this element has props with an 'id'
|
|
71
|
+
const pageElement = child;
|
|
72
|
+
const pageId = pageElement.props.id;
|
|
61
73
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
// Get the metadata from our data object
|
|
75
|
+
const pageMetadata = validData.pages[pageId];
|
|
76
|
+
if (!pageMetadata) {
|
|
77
|
+
console.warn("No metadata found in data object for page ID: ".concat(pageId));
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouter.Route, {
|
|
81
|
+
path: pageMetadata.slug,
|
|
82
|
+
element: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Wrapper.default, {
|
|
83
|
+
data: validData,
|
|
84
|
+
component: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Page.default, {
|
|
85
|
+
page: pageElement,
|
|
86
|
+
data: pageMetadata
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
}, pageId);
|
|
90
|
+
})]
|
|
77
91
|
})
|
|
78
|
-
})
|
|
79
|
-
})
|
|
92
|
+
})
|
|
93
|
+
});
|
|
80
94
|
}
|
|
81
|
-
|
|
95
|
+
var _default = exports.default = SiteGen;
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = ArrowBack;
|
|
7
|
+
var _reactRouter = require("react-router");
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
function ArrowBack() {
|
|
10
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouter.Link, {
|
|
11
|
+
to: "/all-content",
|
|
12
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
13
|
+
src: "/arrow-left.svg",
|
|
14
|
+
alt: "Back to content list",
|
|
15
|
+
width: 40,
|
|
16
|
+
height: 40
|
|
17
|
+
})
|
|
18
|
+
});
|
|
11
19
|
}
|
package/lib/components/Footer.js
CHANGED
|
@@ -1,31 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = Footer;
|
|
7
|
+
var _theme = require("../theme");
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
function Footer(_ref) {
|
|
10
|
+
let {
|
|
11
|
+
data
|
|
12
|
+
} = _ref;
|
|
13
|
+
const [theme] = (0, _theme.useCurrentTheme)();
|
|
14
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("footer", {
|
|
7
15
|
className: "bg-gray-800 text-white py-4 m-0",
|
|
8
16
|
style: theme === "light" ? {
|
|
9
17
|
backgroundColor: data.brandColor
|
|
10
18
|
} : {
|
|
11
19
|
backgroundColor: data.brandColorDark
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
},
|
|
21
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
22
|
+
className: "container mx-auto",
|
|
23
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
|
|
24
|
+
children: data.siteTitle
|
|
25
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
26
|
+
className: "sm",
|
|
27
|
+
children: data.siteDescription
|
|
28
|
+
}), data.socialMedia && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
29
|
+
children: ["Follow us on ", /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
|
30
|
+
className: "d-flex flex-wrap w-100 mw-100 list-unstyled link-underline-opacity-0 link-underline-opactiy-100",
|
|
31
|
+
children: Object.entries(data.socialMedia).map(_ref2 => {
|
|
32
|
+
let [key, value] = _ref2;
|
|
33
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
34
|
+
className: "p-2 m-3",
|
|
35
|
+
children: [value.image && value.imageDark && /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
36
|
+
src: theme === "light" ? value.image : value.imageDark,
|
|
37
|
+
alt: key
|
|
38
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
39
|
+
href: value.href,
|
|
40
|
+
className: "p-1",
|
|
41
|
+
children: key
|
|
42
|
+
})]
|
|
43
|
+
}, key);
|
|
44
|
+
})
|
|
45
|
+
})]
|
|
46
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
47
|
+
className: "text-center",
|
|
48
|
+
children: ["\xA9 ", new Date().getFullYear(), " All rights reserved."]
|
|
49
|
+
})]
|
|
50
|
+
})
|
|
51
|
+
});
|
|
31
52
|
}
|
package/lib/components/Navbar.js
CHANGED
|
@@ -1,70 +1,92 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = Navbar;
|
|
7
|
+
var _theme = require("../theme");
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _reactRouter = require("react-router");
|
|
10
|
+
require("../styles/hamburgers.min.css");
|
|
11
|
+
require("../styles/navbar.css");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function Navbar(_ref) {
|
|
14
|
+
var _data$customNavLinks;
|
|
15
|
+
let {
|
|
16
|
+
data
|
|
17
|
+
} = _ref;
|
|
18
|
+
const [theme, setTheme] = (0, _theme.useCurrentTheme)();
|
|
19
|
+
const [active, setActive] = (0, _react.useState)(false);
|
|
11
20
|
document.documentElement.setAttribute("data-bs-theme", theme);
|
|
12
|
-
return /*#__PURE__*/
|
|
13
|
-
className:
|
|
21
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("nav", {
|
|
22
|
+
className: "navbar border-bottom border-1 border-dark mb-2 d-flex justify-content-between align-items-center ".concat(theme === "dark" && "navbar-dark", " "),
|
|
14
23
|
style: theme === "light" ? {
|
|
15
24
|
backgroundColor: data.brandColor
|
|
16
25
|
} : {
|
|
17
26
|
backgroundColor: data.brandColorDark
|
|
18
|
-
}
|
|
19
|
-
}, /*#__PURE__*/React.createElement(Link, {
|
|
20
|
-
className: "navbar-brand px-2",
|
|
21
|
-
to: "/"
|
|
22
|
-
}, data.siteTitle), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("button", {
|
|
23
|
-
className: "p-2 border border-0 bg-transparent",
|
|
24
|
-
id: "theme-toggle",
|
|
25
|
-
type: "button",
|
|
26
|
-
onClick: () => {
|
|
27
|
-
setTheme(oppositeTheme(theme));
|
|
28
27
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
28
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouter.Link, {
|
|
29
|
+
className: "navbar-brand px-2",
|
|
30
|
+
to: "/",
|
|
31
|
+
children: data.siteTitle
|
|
32
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
33
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
34
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
35
|
+
className: "p-2 border border-0 bg-transparent",
|
|
36
|
+
id: "theme-toggle",
|
|
37
|
+
type: "button",
|
|
38
|
+
onClick: () => {
|
|
39
|
+
setTheme((0, _theme.oppositeTheme)(theme));
|
|
40
|
+
},
|
|
41
|
+
"aria-label": "Toggle theme",
|
|
42
|
+
title: "Toggle theme",
|
|
43
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
44
|
+
src: data.brandColorIsDark || theme === "dark" ? "/".concat(theme, "-theme-white.svg") : "/".concat(theme, "-theme.svg"),
|
|
45
|
+
className: "d-inline",
|
|
46
|
+
alt: "".concat(theme, " theme")
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
50
|
+
className: "hamburger hamburger--spin ".concat(active ? "is-active" : ""),
|
|
51
|
+
type: "button",
|
|
52
|
+
onClick: () => setActive(!active),
|
|
53
|
+
"aria-label": "Toggle navigation",
|
|
54
|
+
title: "Toggle navigation",
|
|
55
|
+
"aria-controls": "navbarSupportedContent",
|
|
56
|
+
"aria-expanded": active,
|
|
57
|
+
"aria-haspopup": "true",
|
|
58
|
+
"data-bs-toggle": "collapse",
|
|
59
|
+
"data-bs-target": "#navbarSupportedContent",
|
|
60
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
61
|
+
className: "hamburger-box",
|
|
62
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
63
|
+
className: "hamburger-inner ".concat(theme === "dark" && "bg-light")
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
})]
|
|
67
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
68
|
+
className: "collapse navbar-collapse border-top border-1 border-dark",
|
|
69
|
+
id: "navbarSupportedContent",
|
|
70
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("ul", {
|
|
71
|
+
className: "navbar-nav me-auto mb-2 mb-lg-0",
|
|
72
|
+
children: [Object.values(data.pages).map(page => /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
73
|
+
className: "nav-item",
|
|
74
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouter.Link, {
|
|
75
|
+
className: "nav-link",
|
|
76
|
+
to: page.slug,
|
|
77
|
+
children: page.linkText || page.title
|
|
78
|
+
})
|
|
79
|
+
}, page.slug)), (_data$customNavLinks = data.customNavLinks) === null || _data$customNavLinks === void 0 ? void 0 : _data$customNavLinks.map(link => /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
80
|
+
className: "nav-item",
|
|
81
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
82
|
+
className: "nav-link",
|
|
83
|
+
href: link.href,
|
|
84
|
+
target: "_blank",
|
|
85
|
+
rel: "noopener noreferrer",
|
|
86
|
+
children: link.text
|
|
87
|
+
})
|
|
88
|
+
}, link.href))]
|
|
89
|
+
})
|
|
90
|
+
})]
|
|
91
|
+
});
|
|
70
92
|
}
|
|
@@ -1,15 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
data
|
|
14
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = Wrapper;
|
|
7
|
+
var _Footer = _interopRequireDefault(require("./Footer"));
|
|
8
|
+
var _Navbar = _interopRequireDefault(require("./Navbar"));
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
function Wrapper(_ref) {
|
|
12
|
+
let {
|
|
13
|
+
data,
|
|
14
|
+
component
|
|
15
|
+
} = _ref;
|
|
16
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
17
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Navbar.default, {
|
|
18
|
+
data: data
|
|
19
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
20
|
+
className: "container",
|
|
21
|
+
id: "all-content",
|
|
22
|
+
children: component
|
|
23
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Footer.default, {
|
|
24
|
+
data: data
|
|
25
|
+
})]
|
|
26
|
+
});
|
|
15
27
|
}
|
package/lib/index.js
CHANGED
package/lib/pages/Content.js
CHANGED
|
@@ -1,24 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = Content;
|
|
7
|
+
var _reactRouter = require("react-router");
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
function Content(_ref) {
|
|
10
|
+
let {
|
|
11
|
+
data
|
|
12
|
+
} = _ref;
|
|
13
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
14
|
+
className: "container",
|
|
15
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("h2", {
|
|
16
|
+
children: [data.siteTitle, " content"]
|
|
17
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
18
|
+
className: "row",
|
|
19
|
+
children: Object.values(data.pages).map((page, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
20
|
+
className: "col-md-4 mb-4 mx-2",
|
|
21
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
22
|
+
className: "card h-100",
|
|
23
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
24
|
+
className: "card-body",
|
|
25
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h5", {
|
|
26
|
+
className: "card-title",
|
|
27
|
+
children: page.title
|
|
28
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
29
|
+
className: "card-text",
|
|
30
|
+
children: page.description
|
|
31
|
+
}), page.withLink && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouter.Link, {
|
|
32
|
+
to: "/".concat(page.slug),
|
|
33
|
+
className: "btn btn-primary",
|
|
34
|
+
children: "Read more"
|
|
35
|
+
})]
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
}, index))
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
24
41
|
}
|
package/lib/pages/Home.js
CHANGED
|
@@ -1,63 +1,99 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = Home;
|
|
7
|
+
var _reactRouter = require("react-router");
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
require("../styles/Home.css");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function Home(_ref) {
|
|
12
|
+
var _data$answeredQuestio, _data$startUpPages;
|
|
13
|
+
let {
|
|
14
|
+
data
|
|
15
|
+
} = _ref;
|
|
16
|
+
const [searchQuery, setSearchQuery] = (0, _react.useState)("");
|
|
17
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
18
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("section", {
|
|
19
|
+
className: "d-flex",
|
|
20
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
21
|
+
className: "w-50 d-flex flex-column justify-content-center align-items-center",
|
|
22
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h1", {
|
|
23
|
+
className: "fw-bolder center",
|
|
24
|
+
id: "hero-title",
|
|
25
|
+
dangerouslySetInnerHTML: {
|
|
26
|
+
__html: data.motto || data.siteTitle
|
|
27
|
+
}
|
|
28
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
29
|
+
children: data.siteDescription
|
|
30
|
+
})]
|
|
31
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
32
|
+
className: "w-50 p-2",
|
|
33
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
34
|
+
src: "/home-image.jpg",
|
|
35
|
+
alt: "Eye-catcher",
|
|
36
|
+
className: "w-100"
|
|
37
|
+
})
|
|
38
|
+
})]
|
|
39
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("section", {
|
|
40
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
41
|
+
className: "form-group w-50 d-inline-block me-3",
|
|
42
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
43
|
+
type: "search",
|
|
44
|
+
id: "search",
|
|
45
|
+
list: "searchdata",
|
|
46
|
+
value: searchQuery,
|
|
47
|
+
onChange: e => setSearchQuery(e.target.value),
|
|
48
|
+
className: "form-control",
|
|
49
|
+
placeholder: "Search for content"
|
|
50
|
+
})
|
|
51
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouter.Link, {
|
|
52
|
+
to: {
|
|
53
|
+
pathname: "/search",
|
|
54
|
+
search: "?q=".concat(searchQuery)
|
|
55
|
+
},
|
|
56
|
+
className: "d-inline-block",
|
|
57
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
58
|
+
className: "btn btn-primary p-2",
|
|
59
|
+
children: "Search"
|
|
60
|
+
})
|
|
61
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("datalist", {
|
|
62
|
+
id: "searchdata",
|
|
63
|
+
children: Object.values(data.pages).map((page, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
64
|
+
value: page.title,
|
|
65
|
+
children: page.title
|
|
66
|
+
}, index))
|
|
67
|
+
})]
|
|
68
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("hr", {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("section", {
|
|
69
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
70
|
+
children: "We answer these questions and more: "
|
|
71
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
|
72
|
+
children: (_data$answeredQuestio = data.answeredQuestions) === null || _data$answeredQuestio === void 0 ? void 0 : _data$answeredQuestio.map((question, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
73
|
+
children: question
|
|
74
|
+
}, index))
|
|
75
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouter.Link, {
|
|
76
|
+
to: "all-content",
|
|
77
|
+
children: "Descover more content"
|
|
78
|
+
})]
|
|
79
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("hr", {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("section", {
|
|
80
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
81
|
+
children: "Dive in with those pages:"
|
|
82
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
|
83
|
+
children: (_data$startUpPages = data.startUpPages) === null || _data$startUpPages === void 0 ? void 0 : _data$startUpPages.map((page, index) => {
|
|
84
|
+
const pageData = Object.values(data.pages).find(p => p.title === page);
|
|
85
|
+
if (!pageData) {
|
|
86
|
+
console.warn("Page with title \"".concat(page, "\" not found in data.pages"));
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
90
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouter.Link, {
|
|
91
|
+
to: "/".concat(pageData.slug),
|
|
92
|
+
children: pageData.shortTitle || pageData.title
|
|
93
|
+
})
|
|
94
|
+
}, index);
|
|
95
|
+
})
|
|
96
|
+
})]
|
|
97
|
+
})]
|
|
98
|
+
});
|
|
63
99
|
}
|
package/lib/pages/Page.js
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
})
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = PageGen;
|
|
7
|
+
var _ArrowBack = _interopRequireDefault(require("../components/ArrowBack"));
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
function PageGen(_ref) {
|
|
11
|
+
let {
|
|
12
|
+
page,
|
|
13
|
+
data
|
|
14
|
+
} = _ref;
|
|
15
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
16
|
+
className: "container mt-3",
|
|
17
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowBack.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
18
|
+
children: data.title
|
|
19
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("blockquote", {
|
|
20
|
+
children: [data.shortTitle || data.title, " - ", data.description]
|
|
21
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("hr", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), page || data.content]
|
|
22
|
+
});
|
|
9
23
|
}
|
package/lib/pages/Search.js
CHANGED
|
@@ -1,40 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
})
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = Search;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactRouter = require("react-router");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
|
+
function Search(_ref) {
|
|
12
|
+
let {
|
|
13
|
+
data
|
|
14
|
+
} = _ref;
|
|
15
|
+
const searchParams = new URLSearchParams((0, _reactRouter.useLocation)().search);
|
|
7
16
|
const query = searchParams.get("q") || "";
|
|
8
|
-
const [searchQuery, setSearchQuery] = useState(query);
|
|
9
|
-
return /*#__PURE__*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
17
|
+
const [searchQuery, setSearchQuery] = (0, _react.useState)(query);
|
|
18
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
19
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h1", {
|
|
20
|
+
children: "Search"
|
|
21
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
22
|
+
className: "form-group w-50 d-inline-block me-3",
|
|
23
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
24
|
+
type: "search",
|
|
25
|
+
id: "search",
|
|
26
|
+
list: "search-data",
|
|
27
|
+
value: searchQuery,
|
|
28
|
+
onChange: e => setSearchQuery(e.target.value),
|
|
29
|
+
className: "form-control",
|
|
30
|
+
placeholder: "Search for content"
|
|
31
|
+
})
|
|
32
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouter.Link, {
|
|
33
|
+
to: {
|
|
34
|
+
pathname: "/search",
|
|
35
|
+
search: "?q=".concat(searchQuery)
|
|
36
|
+
},
|
|
37
|
+
className: "d-inline-block",
|
|
38
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
39
|
+
className: "btn btn-primary p-2",
|
|
40
|
+
children: "Search"
|
|
41
|
+
})
|
|
42
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("datalist", {
|
|
43
|
+
id: "search-data",
|
|
44
|
+
children: Object.values(data.pages).map((page, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
45
|
+
value: page.title,
|
|
46
|
+
children: page.title
|
|
47
|
+
}, index))
|
|
48
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("hr", {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("h2", {
|
|
49
|
+
children: ["Results for \"", query, "\""]
|
|
50
|
+
}), Object.values(data.pages).map((page, index) => {
|
|
51
|
+
if (page.title.toLowerCase().includes(searchQuery.toLowerCase())) return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
52
|
+
className: "mb-3",
|
|
53
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
|
|
54
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouter.Link, {
|
|
55
|
+
to: page.slug,
|
|
56
|
+
children: page.title
|
|
57
|
+
})
|
|
58
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
59
|
+
children: page.description
|
|
60
|
+
})]
|
|
61
|
+
}, index);
|
|
62
|
+
})]
|
|
63
|
+
});
|
|
40
64
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/lib/theme.js
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useCurrentTheme = exports.oppositeTheme = exports.ThemeContext = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
const ThemeContext = exports.ThemeContext = /*#__PURE__*/(0, _react.createContext)("light");
|
|
9
|
+
const oppositeTheme = theme => {
|
|
4
10
|
return theme === "light" ? "dark" : "light";
|
|
5
11
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
12
|
+
exports.oppositeTheme = oppositeTheme;
|
|
13
|
+
const useCurrentTheme = () => {
|
|
14
|
+
const theme = (0, _react.useContext)(ThemeContext);
|
|
15
|
+
const [themeState, setThemeState] = (0, _react.useState)(theme);
|
|
9
16
|
const setTheme = new_theme => {
|
|
10
17
|
localStorage.setItem("theme", new_theme);
|
|
11
18
|
setThemeState(new_theme);
|
|
12
19
|
};
|
|
13
20
|
return [themeState, setTheme];
|
|
14
|
-
};
|
|
21
|
+
};
|
|
22
|
+
exports.useCurrentTheme = useCurrentTheme;
|
package/package.json
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "info-site-generator",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.92",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"author": "Enderfarmer",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "Enderfarmer/info-site-template",
|
|
8
8
|
"private": false,
|
|
9
9
|
"types": "lib/index.d.ts",
|
|
10
|
+
"keywords": [
|
|
11
|
+
"informational",
|
|
12
|
+
"website",
|
|
13
|
+
"generator",
|
|
14
|
+
"template",
|
|
15
|
+
"quick",
|
|
16
|
+
"time saving"
|
|
17
|
+
],
|
|
10
18
|
"scripts": {
|
|
11
19
|
"build": "npm run build:js && npm run build:types",
|
|
12
20
|
"build:js": "babel src -d lib --extensions \".ts,.tsx\" --copy-files",
|
|
@@ -43,6 +51,8 @@
|
|
|
43
51
|
},
|
|
44
52
|
"peerDependencies": {
|
|
45
53
|
"react": ">=16.8.0",
|
|
46
|
-
"react-dom": ">=16.8.0"
|
|
54
|
+
"react-dom": ">=16.8.0",
|
|
55
|
+
"react-router": ">=7.11.0",
|
|
56
|
+
"react-router-dom": ">=7.11.0"
|
|
47
57
|
}
|
|
48
58
|
}
|