-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStory.jsx
More file actions
38 lines (32 loc) · 935 Bytes
/
Story.jsx
File metadata and controls
38 lines (32 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import React from 'react';
import StyleInjector from './StyleInjector';
import { StoryTemplate } from '../../templates/Story';
import { StoryCard } from '../../components/Story';
const Story = ({ entry, widgetFor }) => {
const { data } = entry.toJS();
const excerpt = data.excerpt || data.body;
data.body = widgetFor('body');
data.date = data.date.toLocaleDateString('en', {
year: 'numeric',
month: 'long',
day: 'numeric'
});
return (
<StyleInjector>
<div>
<h2>Card Preview</h2>
<small>
You may see characters that shoudn't be here... Don't worry, they won't appear in the live
website!
</small>
<StoryCard title={data.title} date={data.date} excerpt={excerpt} />
</div>
<hr />
<div>
<h2>Story Preview</h2>
<StoryTemplate data={data} preview />
</div>
</StyleInjector>
);
};
export default Story;