2016-08-23 18:59:26 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*
|
|
|
|
* @providesModule BlogPostHeader
|
|
|
|
*/
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var React = require('React');
|
2016-11-02 12:31:52 +00:00
|
|
|
var BlogPostDate = require('BlogPostDate');
|
2016-08-23 18:59:26 +00:00
|
|
|
|
2017-07-21 02:26:25 +00:00
|
|
|
var BlogPostHeader = React.createClass({
|
|
|
|
render: function() {
|
2016-08-23 18:59:26 +00:00
|
|
|
var post = this.props.post;
|
|
|
|
|
|
|
|
var hero;
|
|
|
|
if (post.hero) {
|
2016-08-30 06:08:50 +00:00
|
|
|
hero = <img src={post.hero} width="650"/>;
|
2016-08-23 18:59:26 +00:00
|
|
|
}
|
|
|
|
|
2016-08-25 18:02:27 +00:00
|
|
|
var title = post.title;
|
|
|
|
var href = "/react-native/blog/" + post.path;
|
|
|
|
if (this.props.excerpt) {
|
2016-08-30 06:08:50 +00:00
|
|
|
title = <a href={href}>{post.title}</a>;
|
|
|
|
hero = <a href={href}>{hero}</a>;
|
2016-08-25 18:02:27 +00:00
|
|
|
}
|
|
|
|
|
2016-09-08 13:49:36 +00:00
|
|
|
if (post.youtubeVideoId) {
|
|
|
|
var embedURL = "https://www.youtube.com/embed/" + post.youtubeVideoId;
|
2016-09-07 18:15:44 +00:00
|
|
|
hero = <div className="video-container youtube">
|
|
|
|
<iframe id="ytplayer" type="text/html" width="650" height="345"
|
2016-09-08 13:49:36 +00:00
|
|
|
src={embedURL}
|
2016-09-07 18:15:44 +00:00
|
|
|
frameBorder="0"></iframe>
|
|
|
|
</div>;
|
|
|
|
}
|
|
|
|
|
2016-08-23 18:59:26 +00:00
|
|
|
return (
|
|
|
|
<header className="entry-header">
|
|
|
|
{hero}
|
|
|
|
<h4 className="entry-authordate">
|
|
|
|
<a href={post.authorURL} target="_blank"
|
|
|
|
className="author">
|
|
|
|
{post.author}
|
|
|
|
</a>
|
|
|
|
{' — '}
|
2016-11-02 12:31:52 +00:00
|
|
|
<BlogPostDate post={post} />
|
2016-08-23 18:59:26 +00:00
|
|
|
</h4>
|
2016-08-25 18:02:27 +00:00
|
|
|
<h1 className="entry-title">{title}</h1>
|
2016-08-23 18:59:26 +00:00
|
|
|
</header>
|
|
|
|
);
|
|
|
|
}
|
2017-07-21 02:26:25 +00:00
|
|
|
});
|
2016-08-23 18:59:26 +00:00
|
|
|
|
|
|
|
module.exports = BlogPostHeader;
|