@zendeskgarden/react-typography
Version:
Components relating to typography in the Garden Design System
51 lines (48 loc) • 1.32 kB
JavaScript
/**
* Copyright Zendesk, Inc.
*
* Use of this source code is governed under the Apache License, Version 2.0
* found at http://www.apache.org/licenses/LICENSE-2.0.
*/
import React, { forwardRef } from 'react';
import PropTypes from 'prop-types';
import '../styled/StyledBlockquote.js';
import '../styled/StyledCode.js';
import '../styled/StyledCodeBlock.js';
import '../styled/StyledCodeBlockContainer.js';
import '../styled/StyledCodeBlockLine.js';
import '../styled/StyledCodeBlockToken.js';
import { StyledEllipsis } from '../styled/StyledEllipsis.js';
import '../styled/StyledFont.js';
import '../styled/StyledIcon.js';
import '../styled/StyledList.js';
import '../styled/StyledListItem.js';
import '../styled/StyledParagraph.js';
const Ellipsis = forwardRef((_ref, ref) => {
let {
children,
title,
tag,
...other
} = _ref;
let textContent = undefined;
if (title !== undefined) {
textContent = title;
} else if (typeof children === 'string') {
textContent = children;
}
return React.createElement(StyledEllipsis, Object.assign({
as: tag,
ref: ref,
title: textContent
}, other), children);
});
Ellipsis.displayName = 'Ellipsis';
Ellipsis.propTypes = {
title: PropTypes.string,
tag: PropTypes.any
};
Ellipsis.defaultProps = {
tag: 'div'
};
export { Ellipsis };