diff --git a/src/Pluralize.js b/src/Pluralize.js index 9543a37..c202171 100644 --- a/src/Pluralize.js +++ b/src/Pluralize.js @@ -3,32 +3,38 @@ * Tom Smith (https://github.com/tsmith123) */ -import React from 'react' -import PropTypes from 'prop-types' -import { pluralize } from './utils' +import React from 'react'; +import PropTypes from 'prop-types'; +import { pluralize } from './utils'; -const Plural = ({ className, style, ...props }) => ( - - {pluralize(props)} - -) + +const Plural = ({ className, style, tag: Tag, ...props }) => + Tag ? ( + + {pluralize(props)} + + ) : ( + pluralize(props) + ); Plural.propTypes = { - singular: PropTypes.string.isRequired, - plural: PropTypes.string, + className: PropTypes.string, count: PropTypes.number, + plural: PropTypes.string, showCount: PropTypes.bool, - className: PropTypes.string, + singular: PropTypes.string.isRequired, style: PropTypes.object, + tag: PropTypes.string, zero: PropTypes.string -} +}; Plural.defaultProps = { + className: null, count: 1, showCount: true, - className: null, - style: {}, + style: null, + tag: 'span', zero: null -} +}; -export default Plural +export default Plural;