Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
fix: OPTIC-108: Text on grid view should be truncated
Browse files Browse the repository at this point in the history
  • Loading branch information
yyassi-heartex committed Jan 26, 2024
1 parent 003ed1d commit ed8fd63
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/components/DataGroups/AudioDataGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { MediaPlayer } from "../Common/MediaPlayer/MediaPlayer";

export const AudioDataGroup = ({ value }) => {
return (
<div style={{ padding: 10, height: AudioDataGroup.height }}>
<div style={{ padding: 10, height: AudioDataGroup.height, boxSizing: "content-box" }}>
<MediaPlayer src={value} />
</div>
);
};

AudioDataGroup.height = 42;
AudioDataGroup.height = 32;
20 changes: 13 additions & 7 deletions src/components/DataGroups/TextDataGroup.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
import { Tooltip } from "../Common/Tooltip/Tooltip";

const valueToString = (value) => {
if (typeof value === "string") return value;

try {
return JSON.stringify(value);
} catch {
return value.toString();
return (value ?? "").toString();
}
};

export const TextDataGroup = ({ value }) => {
const output = valueToString(value);

return (
<div
style={{ padding: 5, height: TextDataGroup.height, overflow: "hidden" }}
>
{value ? valueToString(value) : ""}
</div>
<Tooltip title={output}>
<div
style={{ padding: 5, height: TextDataGroup.height, overflow: "hidden", whiteSpace: "nowrap", textOverflow: "ellipsis" }}
>
{output}
</div>
</Tooltip>
);
};

TextDataGroup.height = 77;
TextDataGroup.height = 32;

0 comments on commit ed8fd63

Please sign in to comment.