Unverified Commit cb3ce210 authored by Akira Tsuboi's avatar Akira Tsuboi Committed by GitHub

Fix file path overflowing in error popup (#27575)



## Bug

- [x] Related issues linked using `fixes #number`

fixes #27170

### Before
![before](https://user-images.githubusercontent.com/29579847/127415669-8eecf6e3-aba0-408f-9af5-0014da7bb3ad.png)

### After
![after](https://user-images.githubusercontent.com/29579847/127415724-c5082e06-6a68-4f80-828b-ed8ef939b9fb.png)
parent ac58857d
...@@ -63,30 +63,31 @@ export const CodeFrame: React.FC<CodeFrameProps> = function CodeFrame({ ...@@ -63,30 +63,31 @@ export const CodeFrame: React.FC<CodeFrameProps> = function CodeFrame({
// TODO: make the caret absolute // TODO: make the caret absolute
return ( return (
<div data-nextjs-codeframe> <div data-nextjs-codeframe>
<p <div>
role="link" <p
onClick={open} role="link"
tabIndex={1} onClick={open}
title="Click to open in your editor" 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"
> >
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path> <span>
<polyline points="15 3 21 3 21 9"></polyline> {getFrameSource(stackFrame)} @ {stackFrame.methodName}
<line x1="10" y1="14" x2="21" y2="3"></line> </span>
</svg> <svg
</p> xmlns="http://www.w3.org/2000/svg"
<hr /> 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> <pre>
{decoded.map((entry, index) => ( {decoded.map((entry, index) => (
<span <span
......
...@@ -2,6 +2,7 @@ import { noop as css } from '../../helpers/noop-template' ...@@ -2,6 +2,7 @@ import { noop as css } from '../../helpers/noop-template'
const styles = css` const styles = css`
[data-nextjs-codeframe] { [data-nextjs-codeframe] {
overflow: auto;
border-radius: var(--size-gap-half); border-radius: var(--size-gap-half);
background-color: var(--color-ansi-bg); background-color: var(--color-ansi-bg);
color: var(--color-ansi-fg); color: var(--color-ansi-fg);
...@@ -21,31 +22,31 @@ const styles = css` ...@@ -21,31 +22,31 @@ const styles = css`
padding: calc(var(--size-gap) + var(--size-gap-half)) padding: calc(var(--size-gap) + var(--size-gap-half))
calc(var(--size-gap-double) + var(--size-gap-half)); calc(var(--size-gap-double) + var(--size-gap-half));
} }
[data-nextjs-codeframe] > hr { [data-nextjs-codeframe] > div {
margin: 0; display: inline-block;
padding: 0; width: auto;
min-width: 100%;
border: none; border-bottom: 1px solid var(--color-ansi-bright-black);
border-style: solid;
border-width: 0;
border-bottom-width: 1px;
border-color: var(--color-ansi-bright-black);
} }
[data-nextjs-codeframe] > div > p {
[data-nextjs-codeframe] > p {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
cursor: pointer; cursor: pointer;
margin: 0;
} }
[data-nextjs-codeframe] > p:hover { [data-nextjs-codeframe] > div > p:hover {
text-decoration: underline dotted; text-decoration: underline dotted;
} }
[data-nextjs-codeframe] > p > svg { [data-nextjs-codeframe] div > p > svg {
width: auto; width: auto;
height: 1em; height: 1em;
margin-left: 8px; margin-left: 8px;
} }
[data-nextjs-codeframe] div > pre {
overflow: hidden;
display: inline-block;
}
` `
export { styles } export { styles }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment