@cntrl-site/sdk-nextjs 0.1.3 → 0.1.4

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.
@@ -0,0 +1,5 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <state>
3
+ <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
4
+ </state>
5
+ </component>
@@ -12,16 +12,6 @@ const Article_1 = require("./Article");
12
12
  const Page = ({ article, project, meta }) => {
13
13
  const googleFonts = (0, html_react_parser_1.default)(project.fonts.google);
14
14
  const adobeFonts = (0, html_react_parser_1.default)(project.fonts.adobe);
15
- const getPageMeta = (projectMeta, pageMeta) => {
16
- return {
17
- title: pageMeta.title ? pageMeta.title : projectMeta.title,
18
- description: pageMeta.description ? pageMeta.description : projectMeta.description,
19
- keywords: pageMeta.keywords ? pageMeta.keywords : projectMeta.keywords,
20
- opengraphThumbnail: pageMeta.opengraphThumbnail ? pageMeta.opengraphThumbnail : projectMeta.opengraphThumbnail,
21
- favicon: projectMeta.favicon
22
- };
23
- };
24
- const priorityMeta = getPageMeta(project.meta, meta);
25
15
  const parsedFonts = {
26
16
  ...(typeof googleFonts === 'object' ? googleFonts : {}),
27
17
  ...(typeof adobeFonts === 'object' ? adobeFonts : {})
@@ -31,7 +21,7 @@ const Page = ({ article, project, meta }) => {
31
21
  const afterBodyOpen = (0, html_react_parser_1.default)(project.html.afterBodyOpen);
32
22
  const beforeBodyClose = (0, html_react_parser_1.default)(project.html.beforeBodyClose);
33
23
  const ffGenerator = new sdk_1.FontFaceGenerator(customFonts);
34
- 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: priorityMeta.title }), (0, jsx_runtime_1.jsx)("meta", { name: "description", content: priorityMeta.description }), (0, jsx_runtime_1.jsx)("meta", { name: "keywords", content: priorityMeta.keywords }), (0, jsx_runtime_1.jsx)("meta", { property: "og:image", content: priorityMeta.opengraphThumbnail }), (0, jsx_runtime_1.jsx)("link", { rel: "icon", href: priorityMeta.favicon }), customFonts.length > 0 && ((0, jsx_runtime_1.jsx)("style", { dangerouslySetInnerHTML: {
24
+ 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: {
35
25
  __html: ffGenerator.generate()
36
26
  } })), Object.values(parsedFonts).map((value, i) => {
37
27
  if (!value)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk-nextjs",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "SDK for Next.js",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/index.js",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "homepage": "https://github.com/cntrl-site/sdk-nextjs#readme",
23
23
  "dependencies": {
24
- "@cntrl-site/sdk": "^0.2.2",
24
+ "@cntrl-site/sdk": "^0.2.4",
25
25
  "html-react-parser": "^3.0.1",
26
26
  "styled-jsx": "^5.0.2"
27
27
  },
@@ -1,6 +1,6 @@
1
1
  import React, { FC } from 'react';
2
2
  import HTMLReactParser, { domToReact } from 'html-react-parser';
3
- import { TArticle, TProject, TMeta, FontFaceGenerator, TPageMeta } from '@cntrl-site/sdk';
3
+ import { TArticle, TProject, TMeta, FontFaceGenerator } from '@cntrl-site/sdk';
4
4
  import Head from 'next/head';
5
5
  import { Article } from './Article';
6
6
 
@@ -13,17 +13,6 @@ interface Props {
13
13
  export const Page: FC<Props> = ({ article, project, meta }) => {
14
14
  const googleFonts: ReturnType<typeof domToReact> = HTMLReactParser(project.fonts.google);
15
15
  const adobeFonts: ReturnType<typeof domToReact> = HTMLReactParser(project.fonts.adobe);
16
-
17
- const getPageMeta = (projectMeta: TMeta, pageMeta: TPageMeta): TMeta => {
18
- return {
19
- title: pageMeta.title ? pageMeta.title : projectMeta.title,
20
- description: pageMeta.description ? pageMeta.description : projectMeta.description,
21
- keywords: pageMeta.keywords ? pageMeta.keywords : projectMeta.keywords,
22
- opengraphThumbnail: pageMeta.opengraphThumbnail ? pageMeta.opengraphThumbnail : projectMeta.opengraphThumbnail,
23
- favicon: projectMeta.favicon
24
- };
25
- };
26
- const priorityMeta = getPageMeta(project.meta, meta);
27
16
  const parsedFonts = {
28
17
  ...(typeof googleFonts === 'object' ? googleFonts : {}),
29
18
  ...(typeof adobeFonts === 'object' ? adobeFonts : {})
@@ -36,11 +25,11 @@ export const Page: FC<Props> = ({ article, project, meta }) => {
36
25
  return (
37
26
  <>
38
27
  <Head>
39
- <title>{priorityMeta.title}</title>
40
- <meta name="description" content={priorityMeta.description} />
41
- <meta name="keywords" content={priorityMeta.keywords} />
42
- <meta property="og:image" content={priorityMeta.opengraphThumbnail} />
43
- <link rel="icon" href={priorityMeta.favicon} />
28
+ <title>{meta.title}</title>
29
+ <meta name="description" content={meta.description} />
30
+ <meta name="keywords" content={meta.keywords} />
31
+ <meta property="og:image" content={meta.opengraphThumbnail} />
32
+ <link rel="icon" href={meta.favicon} />
44
33
  {customFonts.length > 0 && (
45
34
  <style
46
35
  dangerouslySetInnerHTML={{
@@ -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>