All files / packages/design-system/ui/shared/truncate index.react.jsx

0% Statements 0/3
0% Branches 0/2
100% Functions 0/0
0% Lines 0/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23                                             
// Copyright (c) 2015-present, salesforce.com, inc. All rights reserved
// Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license
 
import _ from '../helpers';
import React from 'react';
import PropTypes from 'prop-types';
 
class Truncate extends React.Component {
  // TODO: Remove span
  render() {
    const { children, amount } = this.props;
    return (
      <span title={children}>
        {amount ? _.truncate(children, amount) : children}
      </span>
    );
  }
}
 
Truncate.propTypes = { truncate: PropTypes.number };
 
export default Truncate;