Skip to content

Commit

Permalink
fix: 🎨 fix text overflow in description preview and resource tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Pauline Didier committed Jan 7, 2025
1 parent 2de49c2 commit 0a6ded1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
1 change: 1 addition & 0 deletions app/src/components/model/panels/EditableDescription.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export function DescriptionPreview({
sx={{
color: "rgba(255, 255, 255, 0.5)",
borderColor: "rgba(255, 255, 255, 0.5)",
wordBreak: "break-word",
...bSx,
}}
></Box>
Expand Down
38 changes: 19 additions & 19 deletions app/src/components/model/panels/left/ResourceList.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,26 @@ function groupResourceBy(resources, key) {
});
}

function ListItem({ resource }) {
return (
<Typography sx={{ wordBreak: "break-word" }} variant="body1">
<Typography component="span" sx={{ fontWeight: "bold" }}>
{resource.key}:{" "}
</Typography>
<Typography component="span" sx={{ fontSize: "0.95rem" }}>
{resource.value}
</Typography>
</Typography>
);
}

function AttributeList({ attributes }) {
const [showAll, setShowAll] = useState(false);
const attributeList = Object.entries(attributes).map(([key, value]) => {
return (
<Typography variant="body2" sx={{ pl: "1em" }} key={key}>
- <strong>{key}:</strong> {value}
</Typography>
);
return <ListItem key={key} resource={{ key, value }} />;
});
return (
<Stack direction="column">
<Typography variant="body1" sx={{ fontWeight: "bold" }}>
Attributes:
</Typography>
<>
{showAll ? attributeList : attributeList.slice(0, 2)}
<Typography
sx={{ pl: "1em", cursor: "pointer", textDecoration: "underline" }}
Expand All @@ -47,7 +53,7 @@ function AttributeList({ attributes }) {
>
{showAll ? "See less" : "See more"}
</Typography>
</Stack>
</>
);
}

Expand All @@ -58,15 +64,9 @@ function StandardList({ resources }) {
<Typography>{resource.displayName}</Typography>
</AccordionSummary>
<AccordionDetails>
<Typography variant="body1">
<strong>Id: </strong> {resource.id}
</Typography>
<Typography variant="body1">
<strong>Type: </strong> {resource.type}
</Typography>
<Typography variant="body1">
<strong>System id: </strong> {resource.systemId}
</Typography>
<ListItem resource={{ key: "Id", value: resource.id }} />
<ListItem resource={{ key: "Type", value: resource.type }} />
<ListItem resource={{ key: "System id", value: resource.systemId }} />
{resource.attributes && (
<AttributeList attributes={resource.attributes} />
)}
Expand Down

0 comments on commit 0a6ded1

Please sign in to comment.