Unverified Commit 1b36d761 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

fix dev overlay version indicator style (#66278)

Fix the Build Error indicator location, it should be located on the
top-right corner. Align the padding with

### Build Error


![image](https://github.com/vercel/next.js/assets/4800338/835506a5-bf29-4f3e-ae0e-091dc9a7b386)

### Runtime Error


![image](https://github.com/vercel/next.js/assets/4800338/2a61a933-58f2-471e-9d3f-84b3954b1460)
parent 14156098
import React from 'react'
import type { VersionInfo } from '../../../../../../server/dev/parse-version-info' import type { VersionInfo } from '../../../../../../server/dev/parse-version-info'
export function VersionStalenessInfo(props: VersionInfo) { export function VersionStalenessInfo({
if (!props) return null versionInfo,
const { staleness } = props }: {
let { text, indicatorClass, title } = getStaleness(props) versionInfo: VersionInfo | undefined
}) {
if (!versionInfo) return null
const { staleness } = versionInfo
let { text, indicatorClass, title } = getStaleness(versionInfo)
if (!text) return null if (!text) return null
return ( return (
<small className="nextjs-container-build-error-version-status"> <span className="nextjs-container-build-error-version-status">
<span className={indicatorClass} /> <span className={indicatorClass} />
<small data-nextjs-version-checker title={title}> <small data-nextjs-version-checker title={title}>
{text} {text}
...@@ -26,7 +29,7 @@ export function VersionStalenessInfo(props: VersionInfo) { ...@@ -26,7 +29,7 @@ export function VersionStalenessInfo(props: VersionInfo) {
</a> </a>
)} )}
{process.env.TURBOPACK ? ' (turbo)' : ''} {process.env.TURBOPACK ? ' (turbo)' : ''}
</small> </span>
) )
} }
......
...@@ -6,7 +6,6 @@ const styles = css` ...@@ -6,7 +6,6 @@ const styles = css`
text-align: right; text-align: right;
} }
.nextjs-container-build-error-version-status small { .nextjs-container-build-error-version-status small {
margin-left: var(--size-gap);
font-size: var(--size-font-small); font-size: var(--size-font-small);
} }
.nextjs-container-build-error-version-status a { .nextjs-container-build-error-version-status a {
......
...@@ -29,13 +29,13 @@ export const BuildError: React.FC<BuildErrorProps> = function BuildError({ ...@@ -29,13 +29,13 @@ export const BuildError: React.FC<BuildErrorProps> = function BuildError({
<DialogContent> <DialogContent>
<DialogHeader className="nextjs-container-errors-header"> <DialogHeader className="nextjs-container-errors-header">
<h1 id="nextjs__container_errors_label">{'Build Error'}</h1> <h1 id="nextjs__container_errors_label">{'Build Error'}</h1>
<VersionStalenessInfo versionInfo={versionInfo} />
<p <p
id="nextjs__container_errors_desc" id="nextjs__container_errors_desc"
className="nextjs__container_errors_desc" className="nextjs__container_errors_desc"
> >
Failed to compile Failed to compile
</p> </p>
{versionInfo ? <VersionStalenessInfo {...versionInfo} /> : null}
</DialogHeader> </DialogHeader>
<DialogBody className="nextjs-container-errors-body"> <DialogBody className="nextjs-container-errors-body">
<Terminal content={message} /> <Terminal content={message} />
......
...@@ -265,7 +265,7 @@ export function Errors({ ...@@ -265,7 +265,7 @@ export function Errors({
{' error'} {' error'}
{readyErrors.length < 2 ? '' : 's'} {readyErrors.length < 2 ? '' : 's'}
</small> </small>
{versionInfo ? <VersionStalenessInfo {...versionInfo} /> : null} <VersionStalenessInfo versionInfo={versionInfo} />
</LeftRightDialogHeader> </LeftRightDialogHeader>
<h1 id="nextjs__container_errors_label"> <h1 id="nextjs__container_errors_label">
{isServerError ? 'Server Error' : 'Unhandled Runtime Error'} {isServerError ? 'Server Error' : 'Unhandled Runtime Error'}
...@@ -323,6 +323,9 @@ export function Errors({ ...@@ -323,6 +323,9 @@ export function Errors({
} }
export const styles = css` export const styles = css`
.nextjs-container-errors-header {
position: relative;
}
.nextjs-container-errors-header > h1 { .nextjs-container-errors-header > h1 {
font-size: var(--size-font-big); font-size: var(--size-font-big);
line-height: var(--size-font-bigger); line-height: var(--size-font-bigger);
...@@ -406,4 +409,10 @@ export const styles = css` ...@@ -406,4 +409,10 @@ export const styles = css`
.nextjs-toast-errors-hide-button:hover { .nextjs-toast-errors-hide-button:hover {
opacity: 1; opacity: 1;
} }
.nextjs-container-errors-header
> .nextjs-container-build-error-version-status {
position: absolute;
top: 0;
right: 0;
}
` `
...@@ -23,10 +23,10 @@ export const RootLayoutMissingTagsError: React.FC<RootLayoutMissingTagsErrorProp ...@@ -23,10 +23,10 @@ export const RootLayoutMissingTagsError: React.FC<RootLayoutMissingTagsErrorProp
> >
<DialogContent> <DialogContent>
<DialogHeader className="nextjs-container-errors-header"> <DialogHeader className="nextjs-container-errors-header">
<VersionStalenessInfo versionInfo={versionInfo} />
<h3 id="nextjs__container_errors_label"> <h3 id="nextjs__container_errors_label">
Missing required html tags Missing required html tags
</h3> </h3>
{versionInfo ? <VersionStalenessInfo {...versionInfo} /> : null}
<p <p
id="nextjs__container_errors_desc" id="nextjs__container_errors_desc"
className="nextjs__container_errors_desc" className="nextjs__container_errors_desc"
......
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