Debian Codegraph @

pkg/lib/cockpit-components-truncate.tsx

raw
1 /*
2 * Copyright (C) 2024 Red Hat, Inc.
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
6 /* This is our version of the PatternFly Truncate component. We have
7 it since we don't want Patternfly's unconditional tooltip.
8
9 Truncation in the middle doesn't work with Patternsfly's approach
10 in mixed RTL/LTR environments, so we only offer truncation at the
11 end.
12 */
13
14 import * as React from "react";
15 import './cockpit-components-truncate.scss';
16
17 export const Truncate = ({
18 content,
19 ...props
20 }: {
21 content: string,
22 }) => {
23 return (
24 <span className="pf-v6-c-truncate ct-no-truncate-min-width" {...props}>
25 <span className="pf-v6-c-truncate__start">
26 {content}
27 </span>
28 </span>
29 );
30 };