Skip to content

Commit

Permalink
Fix file path overflowing in error popup (vercel#27575)
Browse files Browse the repository at this point in the history
  • Loading branch information
AkiraTsuboi authored and natew committed Feb 16, 2022
1 parent 198dc02 commit 02fa359
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,30 +63,31 @@ export const CodeFrame: React.FC<CodeFrameProps> = function CodeFrame({
// TODO: make the caret absolute
return (
<div data-nextjs-codeframe>
<p
role="link"
onClick={open}
tabIndex={1}
title="Click to open in your editor"
>
<span>
{getFrameSource(stackFrame)} @ {stackFrame.methodName}
</span>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
<div>
<p
role="link"
onClick={open}
tabIndex={1}
title="Click to open in your editor"
>
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>
<polyline points="15 3 21 3 21 9"></polyline>
<line x1="10" y1="14" x2="21" y2="3"></line>
</svg>
</p>
<hr />
<span>
{getFrameSource(stackFrame)} @ {stackFrame.methodName}
</span>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>
<polyline points="15 3 21 3 21 9"></polyline>
<line x1="10" y1="14" x2="21" y2="3"></line>
</svg>
</p>
</div>
<pre>
{decoded.map((entry, index) => (
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { noop as css } from '../../helpers/noop-template'

const styles = css`
[data-nextjs-codeframe] {
overflow: auto;
border-radius: var(--size-gap-half);
background-color: var(--color-ansi-bg);
color: var(--color-ansi-fg);
Expand All @@ -21,31 +22,31 @@ const styles = css`
padding: calc(var(--size-gap) + var(--size-gap-half))
calc(var(--size-gap-double) + var(--size-gap-half));
}
[data-nextjs-codeframe] > hr {
margin: 0;
padding: 0;
border: none;
border-style: solid;
border-width: 0;
border-bottom-width: 1px;
border-color: var(--color-ansi-bright-black);
[data-nextjs-codeframe] > div {
display: inline-block;
width: auto;
min-width: 100%;
border-bottom: 1px solid var(--color-ansi-bright-black);
}
[data-nextjs-codeframe] > p {
[data-nextjs-codeframe] > div > p {
display: flex;
align-items: center;
justify-content: space-between;
cursor: pointer;
margin: 0;
}
[data-nextjs-codeframe] > p:hover {
[data-nextjs-codeframe] > div > p:hover {
text-decoration: underline dotted;
}
[data-nextjs-codeframe] > p > svg {
[data-nextjs-codeframe] div > p > svg {
width: auto;
height: 1em;
margin-left: 8px;
}
[data-nextjs-codeframe] div > pre {
overflow: hidden;
display: inline-block;
}
`

export { styles }

0 comments on commit 02fa359

Please sign in to comment.