Repository URL to install this package:
Version:
0.9.6 ▾
|
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importDefault(require("react"));
const renderProps_1 = require("./renderProps");
class Rating extends react_1.default.PureComponent {
render() {
const { count, value, renderWrap, renderCount, renderEmpty, renderStarList, renderTotal, shouldShowCount, } = this.props;
const formattedCount = shouldShowCount && renderCount(this.props, count);
const totalView = renderTotal(this.props, formattedCount);
const shouldShowStar = Boolean(count || value);
const starView = count || value ? renderStarList(this.props) : renderEmpty(this.props);
const children = [totalView, starView];
return renderWrap(Object.assign({}, this.props, { children }));
}
}
// seo
Rating.schema = 'https://schema.org/Rating';
Rating.defaultProps = {
// styled
className: '',
renderWrap: renderProps_1.renderWrap,
// count
shouldShowCount: true,
renderCount: renderProps_1.renderCount,
count: 12,
// value
value: 4.5,
renderTotal: renderProps_1.renderTotal,
renderStarList: renderProps_1.renderStarList,
// empty
renderEmpty: renderProps_1.renderEmpty,
};
exports.Rating = Rating;
exports.default = Rating;
//# sourceMappingURL=Ratings.js.map