Unverified Commit 9f89c65a authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub

[dev-overlay] style: version info staleness click text to learn more (#75768)

When the Next.js version is stale and revealing the docs for the version
staleness, remove `(learn more)` and modify the info text to be
clickable.

### Light


https://github.com/user-attachments/assets/cec6c6a1-a788-4c4d-ab20-416217b42c20

### Dark


https://github.com/user-attachments/assets/02e53d84-146b-4508-b877-586a7fb0195e

Closes NDX-637
parent 1c85b755
import type { VersionInfo } from '../../../../../../../server/dev/parse-version-info'
import { cx } from '../../helpers/cx'
import { noop as css } from '../../helpers/noop-template'
export function VersionStalenessInfo({
......@@ -11,23 +12,36 @@ export function VersionStalenessInfo({
const { staleness } = versionInfo
let { text, indicatorClass, title } = getStaleness(versionInfo)
const shouldBeLink = staleness.startsWith('stale')
if (shouldBeLink) {
return (
<a
className={cx(
'nextjs-container-build-error-version-status',
'dialog-exclude-closing-from-outside-click',
isTurbopack && 'turbopack-border'
)}
target="_blank"
rel="noopener noreferrer"
href="https://nextjs.org/docs/messages/version-staleness"
>
<Eclipse
className={cx('version-staleness-indicator', indicatorClass)}
/>
<span data-nextjs-version-checker title={title}>
{text}
</span>
{isTurbopack && <span className="turbopack-text">Turbopack</span>}
</a>
)
}
return (
<span className="nextjs-container-build-error-version-status dialog-exclude-closing-from-outside-click">
<Eclipse className={`version-staleness-indicator ${indicatorClass}`} />
<Eclipse className={cx('version-staleness-indicator', indicatorClass)} />
<span data-nextjs-version-checker title={title}>
{text}
</span>{' '}
{staleness === 'fresh' ||
staleness === 'newer-than-npm' ||
staleness === 'unknown' ? null : (
<a
target="_blank"
rel="noopener noreferrer"
href="https://nextjs.org/docs/messages/version-staleness"
>
(learn more)
</a>
)}
</span>
{isTurbopack && <span className="turbopack-text">Turbopack</span>}
</span>
)
......@@ -94,6 +108,19 @@ export const styles = css`
line-height: var(--size-4);
}
a.nextjs-container-build-error-version-status {
text-decoration: none;
color: var(--color-gray-900);
&:hover {
background: var(--color-gray-100);
}
&:focus {
outline: var(--focus-ring);
}
}
.version-staleness-indicator.fresh {
fill: var(--color-green-800);
stroke: var(--color-green-300);
......
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