File tree 4 files changed +42
-14
lines changed
4 files changed +42
-14
lines changed Original file line number Diff line number Diff line change 6
6
* LICENSE file in the root directory of this source tree.
7
7
*/
8
8
9
- var path = require ( 'path' ) ;
10
9
var React = require ( 'react' ) ;
11
10
var Site = require ( './Site' ) ;
12
- var Marked = require ( './Marked' ) ;
13
11
var BlogSidebar = require ( './BlogSidebar' ) ;
12
+ var BlogPost = require ( './BlogPost' ) ;
14
13
15
14
var BlogLayout = React . createClass ( {
16
15
render : function ( ) {
@@ -20,12 +19,7 @@ var BlogLayout = React.createClass({
20
19
< Site section = "blog" title = { page . title } >
21
20
< section className = "content wrap documentationContent" >
22
21
< BlogSidebar site = { site } page = { page } />
23
- < div className = "inner-content" >
24
- < h1 > { page . title } </ h1 >
25
- < p > { new Date ( page . date ) . toLocaleDateString ( ) } by { page . byline } </ p >
26
- < hr />
27
- < Marked > { page . content } </ Marked >
28
- </ div >
22
+ < BlogPost post = { page } isPermalink = { true } />
29
23
</ section >
30
24
</ Site >
31
25
) ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright (c) 2015, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ var React = require ( 'react' ) ;
10
+ var Marked = require ( './Marked' ) ;
11
+
12
+ var BlogPost = React . createClass ( {
13
+ render : function ( ) {
14
+ var post = this . props . post ;
15
+ var isPermalink = this . props . isPermalink ;
16
+ return (
17
+ < div className = "inner-content" >
18
+ < h1 > { isPermalink ? post . title : < a href = { post . url } > { post . title } </ a > } </ h1 >
19
+ < p > { new Date ( post . date ) . toLocaleDateString ( ) } by { post . byline } </ p >
20
+ { post . guestBio ? < hr /> : null }
21
+ { post . guestBio && < p className = "guestBio" > {
22
+ `This guest article contributed by ${ post . byline } , ${ post . guestBio } .`
23
+ } </ p > }
24
+ < Marked > { post . content } </ Marked >
25
+ </ div >
26
+ ) ;
27
+ }
28
+ } ) ;
29
+
30
+ module . exports = BlogPost ;
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ var React = require('react');
11
11
var Site = require ( '../_core/Site' ) ;
12
12
var Marked = require ( '../_core/Marked' ) ;
13
13
var BlogSidebar = require ( '../_core/BlogSidebar' ) ;
14
+ var BlogPost = require ( '../_core/BlogPost' ) ;
14
15
15
16
var BlogIndex = React . createClass ( {
16
17
render : function ( ) {
@@ -24,12 +25,7 @@ var BlogIndex = React.createClass({
24
25
< section className = "content wrap documentationContent" >
25
26
< BlogSidebar site = { site } />
26
27
{ posts . map ( post =>
27
- < div className = "inner-content" key = { post . permalink } >
28
- < h1 > < a href = { post . url } > { post . title } </ a > </ h1 >
29
- < p > { new Date ( post . date ) . toLocaleDateString ( ) } by { post . byline } </ p >
30
- < hr />
31
- < Marked url = { post . url } > { post . content } </ Marked >
32
- </ div >
28
+ < BlogPost post = { post } isPermalink = { false } key = { post . permalink } />
33
29
) }
34
30
</ section >
35
31
</ Site >
Original file line number Diff line number Diff line change @@ -520,6 +520,14 @@ section.black content {
520
520
padding-bottom : 18px ;
521
521
}
522
522
523
+ .guestBio {
524
+ background : # f9f0f3 ;
525
+ border-top : solid 2px # e0c3c8 ;
526
+ font-style : italic;
527
+ margin : 1em -10px ;
528
+ padding : 10px ;
529
+ }
530
+
523
531
.blogContent {
524
532
* zoom : 1 ;
525
533
padding-top : 20px ;
You can’t perform that action at this time.
0 commit comments