Skip to content

Commit

Permalink
#291 Format long paths better
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhad6 committed Jun 26, 2024
1 parent c2fe1c0 commit 26ec286
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/components/ParamSection/ItemContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const nameContainerSx = {
display: "flex",
alignItems: "center",
columnGap: 1.25,
whiteSpace: "nowrap",
};

type ParamItemContentProps = {
Expand Down
30 changes: 24 additions & 6 deletions src/components/ParamSection/LeafItemContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,23 @@ import { originalDataAtom } from "@/atoms/api";
import { roundAtom, editModeAtom, editedDataAtom } from "@/atoms/paramList";
import ItemContent from "./ItemContent";

const leafItemContentSx = {
pl: "24px",
background: "white",
};

const leafItemReadModeContentSx = {
ml: 2,
display: "flex",
overflow: "hidden",
direction: "rtl", // Hack to overflow to the left instead of the right
};

const leafItemReadModeTextSx = {
whiteSpace: "nowrap",
direction: "ltr", // Switch direction back so text is not messed up
};

type LeafItemReadModeContentProps = {
/** Leaf value to display. */
leaf: Leaf;
Expand All @@ -28,7 +45,13 @@ type LeafItemReadModeContentProps = {
function LeafItemReadModeContent({ leaf }: LeafItemReadModeContentProps) {
const [round] = useAtom(roundAtom);

return <Typography align="right">{leafToString(leaf, round)}</Typography>;
return (
<Box sx={leafItemReadModeContentSx}>
<Typography sx={leafItemReadModeTextSx} title={leafToString(leaf, false)}>
{leafToString(leaf, round)}
</Typography>
</Box>
);
}

type LeafItemEditModeContentProps = {
Expand Down Expand Up @@ -235,11 +258,6 @@ function LeafItemEditModeContent({ editedLeaf, path }: LeafItemEditModeContentPr
);
}

const leafItemContentSx = {
pl: "24px",
background: "white",
};

type LeafItemContentProps = {
/** Name to display. */
name: string;
Expand Down

0 comments on commit 26ec286

Please sign in to comment.