Unverified Commit 55bbf1b4 authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub

[DevOverlay] Apply Turbopack Styling (#74636)

This PR added Turbopack styling.

### Light

![CleanShot 2025-01-08 at 22 55
43](https://github.com/user-attachments/assets/ae636df8-16cd-49a3-861a-42dace9cd431)

### Dark

![CleanShot 2025-01-08 at 22 55
56](https://github.com/user-attachments/assets/c47128b1-236f-4bfe-b8e5-80f7d4638814)

Closes NDX-636

---------
Co-authored-by: 's avatarJiachi Liu <inbox@huozhi.im>
parent 4ce61ca0
...@@ -2,11 +2,13 @@ import { Dialog } from '../../Dialog/Dialog' ...@@ -2,11 +2,13 @@ import { Dialog } from '../../Dialog/Dialog'
import { noop as css } from '../../../helpers/noop-template' import { noop as css } from '../../../helpers/noop-template'
type ErrorOverlayDialogProps = { type ErrorOverlayDialogProps = {
isTurbopack?: boolean
children?: React.ReactNode children?: React.ReactNode
onClose?: () => void onClose?: () => void
} }
export function ErrorOverlayDialog({ export function ErrorOverlayDialog({
isTurbopack,
children, children,
onClose, onClose,
}: ErrorOverlayDialogProps) { }: ErrorOverlayDialogProps) {
...@@ -16,7 +18,7 @@ export function ErrorOverlayDialog({ ...@@ -16,7 +18,7 @@ export function ErrorOverlayDialog({
aria-labelledby="nextjs__container_errors_label" aria-labelledby="nextjs__container_errors_label"
aria-describedby="nextjs__container_errors_desc" aria-describedby="nextjs__container_errors_desc"
onClose={onClose} onClose={onClose}
className="error-overlay-dialog" className={`error-overlay-dialog ${isTurbopack ? 'nextjs-error-overlay-dialog-turbopack-background' : ''}`}
> >
{children} {children}
</Dialog> </Dialog>
...@@ -31,4 +33,18 @@ export const DIALOG_STYLES = css` ...@@ -31,4 +33,18 @@ export const DIALOG_STYLES = css`
box-shadow: var(--shadow-md); box-shadow: var(--shadow-md);
position: relative; position: relative;
} }
.nextjs-error-overlay-dialog-turbopack-background {
border: 1px solid transparent;
background:
linear-gradient(var(--color-background-100), var(--color-background-100))
padding-box,
linear-gradient(
to right top,
var(--color-gray-400) 75%,
var(--color-turbopack-border-blue) 87.5%,
var(--color-turbopack-border-red) 100%
)
border-box;
}
` `
...@@ -3,13 +3,21 @@ import { noop as css } from '../../../helpers/noop-template' ...@@ -3,13 +3,21 @@ import { noop as css } from '../../../helpers/noop-template'
type ErrorOverlayDialogHeaderProps = { type ErrorOverlayDialogHeaderProps = {
children?: React.ReactNode children?: React.ReactNode
isTurbopack?: boolean
} }
export function ErrorOverlayDialogHeader({ export function ErrorOverlayDialogHeader({
children, children,
isTurbopack,
}: ErrorOverlayDialogHeaderProps) { }: ErrorOverlayDialogHeaderProps) {
return ( return (
<DialogHeader className="nextjs-container-errors-header"> <DialogHeader
className={`nextjs-container-errors-header ${
isTurbopack
? 'nextjs-error-overlay-dialog-header-turbopack-background'
: ''
}`}
>
{children} {children}
</DialogHeader> </DialogHeader>
) )
...@@ -48,4 +56,13 @@ export const DIALOG_HEADER_STYLES = css` ...@@ -48,4 +56,13 @@ export const DIALOG_HEADER_STYLES = css`
top: var(--size-4); top: var(--size-4);
right: var(--size-4); right: var(--size-4);
} }
.nextjs-error-overlay-dialog-header-turbopack-background {
background-image: linear-gradient(
10deg,
var(--color-background-100) 60%,
var(--color-turbopack-background-red) 75%,
var(--color-turbopack-background-blue) 100%
);
}
` `
...@@ -10,6 +10,7 @@ type ErrorOverlayFloatingHeaderProps = { ...@@ -10,6 +10,7 @@ type ErrorOverlayFloatingHeaderProps = {
activeIdx?: number activeIdx?: number
setActiveIndex?: (index: number) => void setActiveIndex?: (index: number) => void
versionInfo?: VersionInfo versionInfo?: VersionInfo
isTurbopack?: boolean
} }
export function ErrorOverlayFloatingHeader({ export function ErrorOverlayFloatingHeader({
...@@ -17,6 +18,7 @@ export function ErrorOverlayFloatingHeader({ ...@@ -17,6 +18,7 @@ export function ErrorOverlayFloatingHeader({
activeIdx, activeIdx,
setActiveIndex, setActiveIndex,
versionInfo, versionInfo,
isTurbopack,
}: ErrorOverlayFloatingHeaderProps) { }: ErrorOverlayFloatingHeaderProps) {
return ( return (
<div className="error-overlay-floating-header"> <div className="error-overlay-floating-header">
...@@ -26,7 +28,10 @@ export function ErrorOverlayFloatingHeader({ ...@@ -26,7 +28,10 @@ export function ErrorOverlayFloatingHeader({
activeIdx={activeIdx ?? 0} activeIdx={activeIdx ?? 0}
onActiveIndexChange={setActiveIndex ?? (() => {})} onActiveIndexChange={setActiveIndex ?? (() => {})}
/> />
<VersionStalenessInfo versionInfo={versionInfo} /> <VersionStalenessInfo
versionInfo={versionInfo}
isTurbopack={isTurbopack}
/>
</div> </div>
) )
} }
......
...@@ -26,3 +26,10 @@ export const Default: Story = { ...@@ -26,3 +26,10 @@ export const Default: Story = {
children: "Module not found: Cannot find module './missing-module'", children: "Module not found: Cannot find module './missing-module'",
}, },
} }
export const Turbopack: Story = {
args: {
...Default.args,
isTurbopack: true,
},
}
...@@ -48,6 +48,7 @@ type ErrorOverlayLayoutProps = { ...@@ -48,6 +48,7 @@ type ErrorOverlayLayoutProps = {
activeIdx?: number activeIdx?: number
setActiveIndex?: (index: number) => void setActiveIndex?: (index: number) => void
footerMessage?: string footerMessage?: string
isTurbopack?: boolean
} }
export function ErrorOverlayLayout({ export function ErrorOverlayLayout({
...@@ -64,19 +65,20 @@ export function ErrorOverlayLayout({ ...@@ -64,19 +65,20 @@ export function ErrorOverlayLayout({
activeIdx, activeIdx,
setActiveIndex, setActiveIndex,
footerMessage, footerMessage,
isTurbopack = !!process.env.TURBOPACK,
}: ErrorOverlayLayoutProps) { }: ErrorOverlayLayoutProps) {
return ( return (
<Overlay fixed={isBuildError}> <Overlay fixed={isBuildError}>
<ErrorOverlayDialog onClose={onClose} isTurbopack={isTurbopack}>
<ErrorOverlayDialog onClose={onClose}>
<ErrorOverlayFloatingHeader <ErrorOverlayFloatingHeader
readyErrors={readyErrors} readyErrors={readyErrors}
activeIdx={activeIdx} activeIdx={activeIdx}
setActiveIndex={setActiveIndex} setActiveIndex={setActiveIndex}
versionInfo={versionInfo} versionInfo={versionInfo}
isTurbopack={isTurbopack}
/> />
<DialogContent> <DialogContent>
<ErrorOverlayDialogHeader> <ErrorOverlayDialogHeader isTurbopack={isTurbopack}>
<div <div
className="nextjs__container_errors__error_title" className="nextjs__container_errors__error_title"
// allow assertion in tests before error rating is implemented // allow assertion in tests before error rating is implemented
......
...@@ -3,7 +3,7 @@ import { noop as css } from '../../helpers/noop-template' ...@@ -3,7 +3,7 @@ import { noop as css } from '../../helpers/noop-template'
export function VersionStalenessInfo({ export function VersionStalenessInfo({
versionInfo, versionInfo,
isTurbopack = !!process.env.TURBOPACK, isTurbopack,
}: { }: {
versionInfo: VersionInfo | undefined versionInfo: VersionInfo | undefined
isTurbopack?: boolean isTurbopack?: boolean
...@@ -15,7 +15,11 @@ export function VersionStalenessInfo({ ...@@ -15,7 +15,11 @@ export function VersionStalenessInfo({
if (!text) return null if (!text) return null
return ( return (
<span className="nextjs-container-build-error-version-status dialog-exclude-closing-from-outside-click"> <span
className={`nextjs-container-build-error-version-status dialog-exclude-closing-from-outside-click ${
isTurbopack ? 'turbopack-border' : ''
}`}
>
<Eclipse className={`version-staleness-indicator ${indicatorClass}`} /> <Eclipse className={`version-staleness-indicator ${indicatorClass}`} />
<span data-nextjs-version-checker title={title}> <span data-nextjs-version-checker title={title}>
{text} {text}
...@@ -107,18 +111,30 @@ export const styles = css` ...@@ -107,18 +111,30 @@ export const styles = css`
stroke: var(--color-red-300); stroke: var(--color-red-300);
} }
.turbopack-text { .nextjs-container-build-error-version-status.turbopack-border {
background: linear-gradient(280deg, #0096ff 0%, #ff1e56 100%); border: 1px solid transparent;
background:
linear-gradient(var(--color-background-100), var(--color-background-100))
padding-box,
linear-gradient(
to right,
var(--color-turbopack-border-red) 0%,
var(--color-turbopack-border-blue) 100%
)
border-box;
border-radius: var(--rounded-full);
}
.nextjs-container-build-error-version-status > .turbopack-text {
background: linear-gradient(
to right,
var(--color-turbopack-text-red) 0%,
var(--color-turbopack-text-blue) 100%
);
background-clip: text; background-clip: text;
-webkit-background-clip: text; -webkit-background-clip: text;
-webkit-text-fill-color: transparent; -webkit-text-fill-color: transparent;
} }
@media (prefers-color-scheme: dark) {
.turbopack-text {
background: linear-gradient(280deg, #45b2ff 0%, #ff6d92 100%);
}
}
` `
function Eclipse({ className }: { className: string }) { function Eclipse({ className }: { className: string }) {
......
...@@ -92,6 +92,14 @@ export function Colors() { ...@@ -92,6 +92,14 @@ export function Colors() {
--color-green-800: #388e4a; --color-green-800: #388e4a;
--color-green-900: #297c3b; --color-green-900: #297c3b;
--color-green-1000: #18311e; --color-green-1000: #18311e;
/* Turbopack Light - Temporary */
--color-turbopack-text-red: #ff1e56;
--color-turbopack-text-blue: #0096ff;
--color-turbopack-border-red: #f0adbe;
--color-turbopack-border-blue: #adccea;
--color-turbopack-background-red: #fff7f9;
--color-turbopack-background-blue: #f6fbff;
} }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
...@@ -182,6 +190,14 @@ export function Colors() { ...@@ -182,6 +190,14 @@ export function Colors() {
--color-green-800: #388e4a; --color-green-800: #388e4a;
--color-green-900: #63c174; --color-green-900: #63c174;
--color-green-1000: #e5fbeb; --color-green-1000: #e5fbeb;
/* Turbopack Dark - Temporary */
--color-turbopack-text-red: #ff6d92;
--color-turbopack-text-blue: #45b2ff;
--color-turbopack-border-red: #6e293b;
--color-turbopack-border-blue: #284f80;
--color-turbopack-background-red: #250d12;
--color-turbopack-background-blue: #0a1723;
} }
} }
`} `}
......
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