@cleartrip/bento-mobile
Version:
Cleartrip - pwa component library
30 lines (28 loc) • 796 B
JavaScript
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
var Truncate = function Truncate(_ref) {
var children = _ref.children,
className = _ref.className,
width = _ref.width;
var classList = classNames('t-truncate', className);
var styles = {
width: typeof width === 'number' ? "".concat(width, "px") : "".concat(width)
};
return /*#__PURE__*/React.createElement("p", {
className: classList,
style: styles
}, children);
};
Truncate.propTypes = {
className: PropTypes.string,
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
children: PropTypes.node
};
Truncate.defaultProps = {
width: '100%',
className: '',
children: null
};
Truncate.displayName = 'Truncate';
export default Truncate;