Skip to content

Commit 00bec80

Browse files
committed
feat(cms): better post preview and preview styling
1 parent 2bbd4e6 commit 00bec80

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

static/admin/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,19 @@
1717
<body>
1818
<!-- Include the script that builds the page and powers Netlify CMS -->
1919
<script src="https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"></script>
20+
<script>
21+
var PostPreview = createClass({
22+
render: function() {
23+
var entry = this.props.entry;
24+
return h('div', {},
25+
h('h1', {}, entry.getIn(['data', 'title'])),
26+
h('div', {"className": "text"}, this.props.widgetFor('body'))
27+
);
28+
}
29+
});
30+
31+
CMS.registerPreviewStyle("netlify-preview.css");
32+
CMS.registerPreviewTemplate("blog", PostPreview);
33+
</script>
2034
</body>
2135
</html>

static/admin/netlify-preview.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
html,
2+
body {
3+
color: #444;
4+
font-size: 14px;
5+
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
6+
}
7+
8+
body {
9+
padding: 20px;
10+
}
11+
12+
img {
13+
max-width: 100vw;
14+
max-height: 50vw;
15+
margin: 20px auto;
16+
display: block;
17+
}

0 commit comments

Comments
 (0)