react-facebook-next
Version:
Facebook components like a Login button, Like, Share, Comments or Embedded Post
60 lines (55 loc) • 1.65 kB
JavaScript
import React from 'react';
import PropTypes from 'prop-types';
import Parser from './Parser';
import getCurrentHref from './utils/getCurrentHref';
import ColorScheme from './constants/ColorScheme';
import CommentsOrderBy from './constants/CommentsOrderBy';
export default function Comments(props) {
var className = props.className,
colorScheme = props.colorScheme,
_props$href = props.href,
href = _props$href === undefined ? getCurrentHref() : _props$href,
numPosts = props.numPosts,
orderBy = props.orderBy,
width = props.width,
children = props.children,
onParse = props.onParse;
return React.createElement(
Parser,
{ className: className, onParse: onParse },
React.createElement(
'div',
{
className: 'fb-comments',
'data-colorscheme': colorScheme,
'data-numposts': numPosts,
'data-href': href,
'data-order-by': orderBy,
'data-width': width,
'data-skin': colorScheme
},
children
)
);
}
Comments.propTypes = {
className: PropTypes.string,
href: PropTypes.string,
numPosts: PropTypes.number.isRequired,
orderBy: PropTypes.string.isRequired,
width: PropTypes.oneOfType([PropTypes.number.isRequired, PropTypes.string.isRequired]),
colorScheme: PropTypes.string.isRequired,
children: PropTypes.node,
onParse: PropTypes.func
};
Comments.defaultProps = {
numPosts: 10,
orderBy: CommentsOrderBy.SOCIAL,
width: 550,
colorScheme: ColorScheme.LIGHT,
children: undefined,
className: undefined,
href: undefined,
onParse: undefined
};
//# sourceMappingURL=Comments.js.map