diff --git a/client/src/components/util/truncate.js b/client/src/components/util/truncate.js
index c9708e54..be8a91bb 100644
--- a/client/src/components/util/truncate.js
+++ b/client/src/components/util/truncate.js
@@ -118,48 +118,82 @@ export default class Truncate extends Component {
};
render() {
- const { children, size, fontSize, bold, italic } = this.props;
+ const { children } = this.props;
// Truncate only support a single child with a text child
-
if (
React.Children.count(children) === 1 &&
React.Children.count(children.props?.children) === 1
) {
- const originalString = children.props.children;
- const truncatedString = this.maybeTruncateString(
- originalString,
- size,
- fontSize,
- bold,
- italic
- );
+ const originalStr = children.props.children;
+ const firstHalf = originalStr.slice(0, originalStr.length / 2);
+ const secondHalf = originalStr.slice(originalStr.length / 2);
- // Only make tooltip if string has to be truncated
- if (truncatedString) {
- // clone children, changing the children(text) to the truncated string
- const newChildren = React.Children.map(children, (child) =>
- cloneElement(child, {
- children: truncatedString,
- "data-truncated": true,
- })
- );
- return (
-
+
- {newChildren}
-
- );
- }
- return children;
+ {firstHalf}
+
+
+ {secondHalf}
+
+ >
+ );
+
+ const newChildren = React.Children.map(children, (child) =>
+ cloneElement(child, {
+ "data-truncated": true,
+ children: truncatedChildren,
+ style: {
+ ...child.props.style,
+ whiteSpace: "nowrap",
+ overflow: "hidden",
+ },
+ })
+ );
+ return (
+
+ {newChildren}
+
+ );
}
+
throw Error("Only pass a single child with inner text to Truncate");
}
}