Skip to content

Commit

Permalink
Show full message on click
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Dec 16, 2020
1 parent 5719f31 commit 92ebd81
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,16 @@
}

.Message {
cursor: default;
overflow-x: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.Message[data-expanded="true"] {
white-space: pre-wrap;
}

.ErrorBadge,
.WarningBadge {
display: inline-block;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,20 @@ function ErrorOrWarningView({
count,
message,
}: ErrorOrWarningViewProps) {
// TODO Render .ErrorBadge or .WarningBadge if count > 1.
const [expanded, toggleExpanded] = React.useReducer(
currentlyExpanded => !currentlyExpanded,
false,
);

return (
<div className={className}>
{count > 1 && <div className={badgeClassName}>{count}</div>}
<div className={styles.Message}>{message}</div>
<div
className={styles.Message}
data-expanded={expanded}
onClick={toggleExpanded}>
{message}
</div>
</div>
);
}

0 comments on commit 92ebd81

Please sign in to comment.