mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2024-12-26 14:59:14 +01:00
Fix preview templates
This commit is contained in:
parent
0338cd2844
commit
bd0677dfd3
@ -2,5 +2,5 @@ import CMS from 'netlify-cms';
|
|||||||
import PagePreview from './preview-templates/page-preview';
|
import PagePreview from './preview-templates/page-preview';
|
||||||
import PostPreview from './preview-templates/post-preview';
|
import PostPreview from './preview-templates/post-preview';
|
||||||
|
|
||||||
CMS.registerPreviewTemplate('page', PagePreview);
|
CMS.registerPreviewTemplate('pages', PagePreview);
|
||||||
CMS.registerPreviewTemplate('post', PostPreview);
|
CMS.registerPreviewTemplate('posts', PostPreview);
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Page } from '../../components/Page';
|
|
||||||
|
|
||||||
const PagePreview = ({ entry, widgetFor }) => {
|
const PagePreview = ({ entry, widgetFor }) => {
|
||||||
const body = widgetFor(['body']);
|
const body = widgetFor(['body']);
|
||||||
const title = entry.getIn(['data', 'title']);
|
const title = entry.getIn(['data', 'title']);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page title={title}>
|
<div className="page">
|
||||||
<div dangerouslySetInnerHTML={{ __html: body }} />
|
<h1 className="page__title">{title}</h1>
|
||||||
</Page>
|
<div className="page__body" dangerouslySetInnerHTML={{ __html: body }} />
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Content } from '../../components/Post/Content';
|
|
||||||
|
|
||||||
const PostPreview = ({ entry, widgetFor }) => {
|
const PostPreview = ({ entry, widgetFor }) => {
|
||||||
const body = widgetFor(['body']);
|
const body = widgetFor(['body']);
|
||||||
const title = entry.getIn(['data', 'title']);
|
const title = entry.getIn(['data', 'title']);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Content body={body} title={title} />
|
<div className="post">
|
||||||
|
<h1 className="post__title">{title}</h1>
|
||||||
|
<div className="post__body" dangerouslySetInnerHTML={{ __html: body }} />
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user