Skip to content

Commit

Permalink
feat(cms): better post preview and preview styling
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeocodes committed Nov 14, 2020
1 parent 2bbd4e6 commit 00bec80
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
14 changes: 14 additions & 0 deletions static/admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,19 @@
<body>
<!-- Include the script that builds the page and powers Netlify CMS -->
<script src="https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"></script>
<script>
var PostPreview = createClass({
render: function() {
var entry = this.props.entry;
return h('div', {},
h('h1', {}, entry.getIn(['data', 'title'])),
h('div', {"className": "text"}, this.props.widgetFor('body'))
);
}
});

CMS.registerPreviewStyle("netlify-preview.css");
CMS.registerPreviewTemplate("blog", PostPreview);
</script>
</body>
</html>
17 changes: 17 additions & 0 deletions static/admin/netlify-preview.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
html,
body {
color: #444;
font-size: 14px;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

body {
padding: 20px;
}

img {
max-width: 100vw;
max-height: 50vw;
margin: 20px auto;
display: block;
}

0 comments on commit 00bec80

Please # to comment.