Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🎨 fix text overflow in description preview and resource tab #140

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading