@cntrl-site/sdk-nextjs 0.0.7 → 0.0.10
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/components/LayoutStyle.js +19 -0
- package/lib/components/Page.js +1 -1
- package/lib/index.js +19 -1
- package/package.json +3 -3
- package/src/components/LayoutStyle.tsx +22 -0
- package/src/components/Page.tsx +1 -1
- package/src/index.ts +4 -1
- package/.idea/inspectionProfiles/Project_Default.xml +0 -15
- package/cntrl-site-sdk-nextjs-0.0.1.tgz +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LayoutStyle = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const core_1 = require("@cntrl-site/core");
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
const style_1 = __importDefault(require("styled-jsx/style"));
|
|
11
|
+
const LayoutStyle = ({ id, layouts, layoutId, children }) => {
|
|
12
|
+
const layout = layouts.find(l => l.id === layoutId);
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(style_1.default, { id: id, children: `
|
|
14
|
+
${(0, core_1.getLayoutMediaQuery)(layoutId, layouts)} {
|
|
15
|
+
${children?.(layout)}
|
|
16
|
+
}
|
|
17
|
+
` }));
|
|
18
|
+
};
|
|
19
|
+
exports.LayoutStyle = LayoutStyle;
|
package/lib/components/Page.js
CHANGED
|
@@ -19,7 +19,7 @@ const Page = ({ article, project, meta }) => {
|
|
|
19
19
|
const htmlHead = (0, html_react_parser_1.default)(project.html.head);
|
|
20
20
|
const afterBodyOpen = (0, html_react_parser_1.default)(project.html.afterBodyOpen);
|
|
21
21
|
const beforeBodyClose = (0, html_react_parser_1.default)(project.html.beforeBodyClose);
|
|
22
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(head_1.default, { children: [(0, jsx_runtime_1.jsx)("title", { children: meta.title }), (0, jsx_runtime_1.jsx)("meta", { name: "description", content: meta.description }), (0, jsx_runtime_1.jsx)("meta", { name: "keywords", content: meta.keywords }), (0, jsx_runtime_1.jsx)("meta", { property: "og:
|
|
22
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(head_1.default, { children: [(0, jsx_runtime_1.jsx)("title", { children: meta.title }), (0, jsx_runtime_1.jsx)("meta", { name: "description", content: meta.description }), (0, jsx_runtime_1.jsx)("meta", { name: "keywords", content: meta.keywords }), (0, jsx_runtime_1.jsx)("meta", { property: "og:image", content: meta.opengraphThumbnail }), (0, jsx_runtime_1.jsx)("link", { rel: "icon", href: meta.favicon }), customFonts.length > 0 && ((0, jsx_runtime_1.jsx)("style", { dangerouslySetInnerHTML: {
|
|
23
23
|
__html: customFonts.map((font) => (`
|
|
24
24
|
@font-face {
|
|
25
25
|
font-family: ${font.name};
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VideoItem = exports.RichTextItem = exports.RectangleItem = exports.ImageItem = exports.Item = exports.Section = exports.Article = exports.Page = exports.RichTextConverter = void 0;
|
|
17
|
+
exports.LayoutStyle = exports.VideoItem = exports.RichTextItem = exports.RectangleItem = exports.ImageItem = exports.Item = exports.Section = exports.Article = exports.Page = exports.RichTextConverter = void 0;
|
|
18
|
+
__exportStar(require("@cntrl-site/core"), exports);
|
|
19
|
+
__exportStar(require("@cntrl-site/sdk"), exports);
|
|
4
20
|
var RichTextConverter_1 = require("./utils/RichTextConverter");
|
|
5
21
|
Object.defineProperty(exports, "RichTextConverter", { enumerable: true, get: function () { return RichTextConverter_1.RichTextConverter; } });
|
|
6
22
|
var Page_1 = require("./components/Page");
|
|
@@ -19,3 +35,5 @@ var RichTextItem_1 = require("./components/items/RichTextItem");
|
|
|
19
35
|
Object.defineProperty(exports, "RichTextItem", { enumerable: true, get: function () { return RichTextItem_1.RichTextItem; } });
|
|
20
36
|
var VideoItem_1 = require("./components/items/VideoItem");
|
|
21
37
|
Object.defineProperty(exports, "VideoItem", { enumerable: true, get: function () { return VideoItem_1.VideoItem; } });
|
|
38
|
+
var LayoutStyle_1 = require("./components/LayoutStyle");
|
|
39
|
+
Object.defineProperty(exports, "LayoutStyle", { enumerable: true, get: function () { return LayoutStyle_1.LayoutStyle; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cntrl-site/sdk-nextjs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "SDK for Next.js",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/index.js",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://github.com/cntrl-site/sdk-nextjs#readme",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@cntrl-site/core": "^1.0.
|
|
25
|
-
"@cntrl-site/sdk": "^0.0.
|
|
24
|
+
"@cntrl-site/core": "^1.0.7",
|
|
25
|
+
"@cntrl-site/sdk": "^0.0.3",
|
|
26
26
|
"html-react-parser": "^3.0.1",
|
|
27
27
|
"styled-jsx": "^5.0.2"
|
|
28
28
|
},
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
import { getLayoutMediaQuery, TLayout } from '@cntrl-site/core';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import JSXStyle from 'styled-jsx/style';
|
|
5
|
+
|
|
6
|
+
export interface LayoutStyleProps {
|
|
7
|
+
id: string;
|
|
8
|
+
layouts: TLayout[];
|
|
9
|
+
layoutId: string;
|
|
10
|
+
children?: (layout: TLayout) => string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const LayoutStyle: FC<LayoutStyleProps> = ({ id, layouts, layoutId, children }) => {
|
|
14
|
+
const layout = layouts.find(l => l.id === layoutId)!;
|
|
15
|
+
return (
|
|
16
|
+
<JSXStyle id={id}>{`
|
|
17
|
+
${getLayoutMediaQuery(layoutId, layouts)} {
|
|
18
|
+
${children?.(layout)}
|
|
19
|
+
}
|
|
20
|
+
`}</JSXStyle>
|
|
21
|
+
);
|
|
22
|
+
};
|
package/src/components/Page.tsx
CHANGED
|
@@ -27,7 +27,7 @@ export const Page: FC<Props> = ({ article, project, meta }) => {
|
|
|
27
27
|
<title>{meta.title}</title>
|
|
28
28
|
<meta name="description" content={meta.description} />
|
|
29
29
|
<meta name="keywords" content={meta.keywords} />
|
|
30
|
-
<meta property="og:
|
|
30
|
+
<meta property="og:image" content={meta.opengraphThumbnail} />
|
|
31
31
|
<link rel="icon" href={meta.favicon} />
|
|
32
32
|
{customFonts.length > 0 && (
|
|
33
33
|
<style
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from '@cntrl-site/core';
|
|
2
|
+
export * from '@cntrl-site/sdk';
|
|
2
3
|
|
|
4
|
+
export { RichTextConverter } from './utils/RichTextConverter';
|
|
3
5
|
export { Page } from './components/Page';
|
|
4
6
|
export { Article } from './components/Article';
|
|
5
7
|
export { Section } from './components/Section';
|
|
@@ -8,3 +10,4 @@ export { ImageItem } from './components/items/ImageItem';
|
|
|
8
10
|
export { RectangleItem } from './components/items/RectangleItem';
|
|
9
11
|
export { RichTextItem } from './components/items/RichTextItem';
|
|
10
12
|
export { VideoItem } from './components/items/VideoItem';
|
|
13
|
+
export { LayoutStyle } from './components/LayoutStyle';
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<component name="InspectionProjectProfileManager">
|
|
2
|
-
<profile version="1.0">
|
|
3
|
-
<option name="myName" value="Project Default" />
|
|
4
|
-
<inspection_tool class="HtmlUnknownAttribute" enabled="true" level="WARNING" enabled_by_default="true">
|
|
5
|
-
<option name="myValues">
|
|
6
|
-
<value>
|
|
7
|
-
<list size="1">
|
|
8
|
-
<item index="0" class="java.lang.String" itemvalue="jsx" />
|
|
9
|
-
</list>
|
|
10
|
-
</value>
|
|
11
|
-
</option>
|
|
12
|
-
<option name="myCustomValuesEnabled" value="true" />
|
|
13
|
-
</inspection_tool>
|
|
14
|
-
</profile>
|
|
15
|
-
</component>
|
|
Binary file
|