Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
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({
Expand All @@ -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>
)
Expand Down Expand Up @@ -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);
Expand Down
Loading