Unverified Commit 9b35ca8a authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

[Fast Refresh] Adjust Overlay Styling (#12623)

parent 2fa3edcc
...@@ -2,13 +2,10 @@ import { noop as css } from '../../helpers/noop-template' ...@@ -2,13 +2,10 @@ import { noop as css } from '../../helpers/noop-template'
const styles = css` const styles = css`
[data-nextjs-codeframe] { [data-nextjs-codeframe] {
border-radius: 0.3rem; 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);
} }
[data-nextjs-codeframe]:not(:last-child) {
margin-bottom: 1rem;
}
[data-nextjs-codeframe]::selection, [data-nextjs-codeframe]::selection,
[data-nextjs-codeframe] *::selection { [data-nextjs-codeframe] *::selection {
background-color: var(--color-ansi-selection); background-color: var(--color-ansi-selection);
...@@ -21,17 +18,18 @@ const styles = css` ...@@ -21,17 +18,18 @@ const styles = css`
[data-nextjs-codeframe] > * { [data-nextjs-codeframe] > * {
margin: 0; margin: 0;
padding: 0.5rem; padding: calc(var(--size-gap) + var(--size-gap-half))
calc(var(--size-gap-double) + var(--size-gap-half));
} }
[data-nextjs-codeframe] > hr { [data-nextjs-codeframe] > hr {
margin: 0 0.3rem; margin: 0;
padding: 0; padding: 0;
border: none; border: none;
border-style: solid; border-style: solid;
border-width: 0; border-width: 0;
border-bottom-width: 1px; border-bottom-width: 1px;
border-color: var(--color-ansi-fg); border-color: var(--color-ansi-bright-black);
} }
[data-nextjs-codeframe] > p { [data-nextjs-codeframe] > p {
......
...@@ -9,8 +9,9 @@ const styles = css` ...@@ -9,8 +9,9 @@ const styles = css`
margin-left: auto; margin-left: auto;
outline: none; outline: none;
background: white; background: white;
border-radius: 0.5rem; border-radius: var(--size-gap);
box-shadow: 0 0.25rem 0.5rem rgba(22, 28, 45, 0.5); box-shadow: 0 var(--size-gap-half) var(--size-gap-double)
rgba(0, 0, 0, 0.25);
max-height: calc(100% - 3.5rem); max-height: calc(100% - 3.5rem);
overflow-y: hidden; overflow-y: hidden;
} }
...@@ -18,7 +19,7 @@ const styles = css` ...@@ -18,7 +19,7 @@ const styles = css`
@media (min-width: 576px) { @media (min-width: 576px) {
[data-nextjs-dialog] { [data-nextjs-dialog] {
max-width: 540px; max-width: 540px;
box-shadow: 0 0.5rem 1rem rgba(22, 28, 45, 0.5); box-shadow: 0 var(--size-gap) var(--size-gap-quad) rgba(0, 0, 0, 0.25);
} }
} }
...@@ -38,10 +39,10 @@ const styles = css` ...@@ -38,10 +39,10 @@ const styles = css`
position: relative; position: relative;
} }
[data-nextjs-dialog-banner].banner-warning { [data-nextjs-dialog-banner].banner-warning {
border-color: var(--color-ansi-bright-yellow); border-color: var(--color-ansi-yellow);
} }
[data-nextjs-dialog-banner].banner-error { [data-nextjs-dialog-banner].banner-error {
border-color: var(--color-ansi-bright-red); border-color: var(--color-ansi-red);
} }
[data-nextjs-dialog-banner]::after { [data-nextjs-dialog-banner]::after {
...@@ -50,27 +51,28 @@ const styles = css` ...@@ -50,27 +51,28 @@ const styles = css`
top: 0; top: 0;
right: 0; right: 0;
width: 100%; width: 100%;
border-top-width: 5px; /* banner width: */
border-bottom-width: calc(0.375rem - 5px); border-top-width: var(--size-gap-half);
border-bottom-width: 0;
border-top-style: solid; border-top-style: solid;
border-bottom-style: solid; border-bottom-style: solid;
border-top-color: inherit; border-top-color: inherit;
border-bottom-color: transparent; border-bottom-color: transparent;
border-top-left-radius: 0.375rem;
border-top-right-radius: 0.375rem;
} }
[data-nextjs-dialog-content] { [data-nextjs-dialog-content] {
border: none; border: none;
margin: 0; margin: 0;
padding: 1rem; /* calc(padding + banner width offset) */
padding: calc(var(--size-gap-double) + var(--size-gap-half))
var(--size-gap-double);
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
[data-nextjs-dialog-content] > [data-nextjs-dialog-header] { [data-nextjs-dialog-content] > [data-nextjs-dialog-header] {
flex-shrink: 0; flex-shrink: 0;
margin-bottom: var(--size-gap-double);
} }
[data-nextjs-dialog-content] > [data-nextjs-dialog-body] { [data-nextjs-dialog-content] > [data-nextjs-dialog-body] {
position: relative; position: relative;
......
...@@ -104,7 +104,19 @@ const LeftRightDialogHeader: React.FC<LeftRightDialogHeaderProps> = function Lef ...@@ -104,7 +104,19 @@ const LeftRightDialogHeader: React.FC<LeftRightDialogHeaderProps> = function Lef
aria-disabled={previous == null ? true : undefined} aria-disabled={previous == null ? true : undefined}
onClick={previous ?? undefined} onClick={previous ?? undefined}
> >
&larr; <svg
viewBox="0 0 14 14"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M6.99996 1.16666L1.16663 6.99999L6.99996 12.8333M12.8333 6.99999H1.99996H12.8333Z"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
</button> </button>
<button <button
ref={buttonRight} ref={buttonRight}
...@@ -113,7 +125,19 @@ const LeftRightDialogHeader: React.FC<LeftRightDialogHeaderProps> = function Lef ...@@ -113,7 +125,19 @@ const LeftRightDialogHeader: React.FC<LeftRightDialogHeaderProps> = function Lef
aria-disabled={next == null ? true : undefined} aria-disabled={next == null ? true : undefined}
onClick={next ?? undefined} onClick={next ?? undefined}
> >
&rarr; <svg
viewBox="0 0 14 14"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M6.99996 1.16666L12.8333 6.99999L6.99996 12.8333M1.16663 6.99999H12H1.16663Z"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
</button> </button>
&nbsp; &nbsp;
{children} {children}
...@@ -126,18 +150,26 @@ const LeftRightDialogHeader: React.FC<LeftRightDialogHeaderProps> = function Lef ...@@ -126,18 +150,26 @@ const LeftRightDialogHeader: React.FC<LeftRightDialogHeaderProps> = function Lef
> >
<span aria-hidden="true"> <span aria-hidden="true">
<svg <svg
xmlns="http://www.w3.org/2000/svg"
width="24" width="24"
height="24" height="24"
viewBox="0 0 24 24" viewBox="0 0 24 24"
fill="none" fill="none"
stroke="currentColor" xmlns="http://www.w3.org/2000/svg"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
> >
<line x1="18" y1="6" x2="6" y2="18"></line> <path
<line x1="6" y1="6" x2="18" y2="18"></line> d="M18 6L6 18"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M6 6L18 18"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg> </svg>
</span> </span>
</button> </button>
......
...@@ -9,32 +9,37 @@ const styles = css` ...@@ -9,32 +9,37 @@ const styles = css`
justify-content: space-between; justify-content: space-between;
} }
[data-nextjs-dialog-left-right] > nav > button { [data-nextjs-dialog-left-right] > nav > button {
display: inline-flex;
align-items: center;
width: var(--size-gap-quad);
height: var(--size-gap-quad);
font-size: 0;
border: none; border: none;
border-radius: 4px; background-color: rgba(255, 85, 85, 0.1);
background-color: rgba(230, 0, 0, 0.1); color: var(--color-ansi-red);
color: rgba(230, 0, 0, 1);
padding: 3px 9px;
cursor: pointer; cursor: pointer;
font-weight: 500;
transition: background-color 0.25s ease; transition: background-color 0.25s ease;
} }
[data-nextjs-dialog-left-right] > nav > button > svg {
width: auto;
height: var(--size-font-small);
}
[data-nextjs-dialog-left-right] > nav > button:hover { [data-nextjs-dialog-left-right] > nav > button:hover {
background-color: rgba(230, 0, 0, 0.2); background-color: rgba(255, 85, 85, 0.2);
} }
[data-nextjs-dialog-left-right] > nav > button:disabled { [data-nextjs-dialog-left-right] > nav > button:disabled {
background-color: rgba(230, 0, 0, 0.1); background-color: rgba(255, 85, 85, 0.1);
color: rgba(230, 0, 0, 0.2); color: rgba(255, 85, 85, 0.4);
cursor: not-allowed; cursor: not-allowed;
} }
[data-nextjs-dialog-left-right] > nav > button:first-of-type { [data-nextjs-dialog-left-right] > nav > button:first-of-type {
border-top-right-radius: 0px; border-radius: var(--size-gap-half) 0 0 var(--size-gap-half);
border-bottom-right-radius: 0px;
margin-right: 1px; margin-right: 1px;
} }
[data-nextjs-dialog-left-right] > nav > button:last-of-type { [data-nextjs-dialog-left-right] > nav > button:last-of-type {
border-top-left-radius: 0px; border-radius: 0 var(--size-gap-half) var(--size-gap-half) 0;
border-bottom-left-radius: 0px;
} }
[data-nextjs-dialog-left-right] > button:last-of-type { [data-nextjs-dialog-left-right] > button:last-of-type {
......
...@@ -2,7 +2,7 @@ import { noop as css } from '../../helpers/noop-template' ...@@ -2,7 +2,7 @@ import { noop as css } from '../../helpers/noop-template'
const styles = css` const styles = css`
[data-nextjs-terminal] { [data-nextjs-terminal] {
border-radius: 0.3rem; 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);
} }
...@@ -17,7 +17,8 @@ const styles = css` ...@@ -17,7 +17,8 @@ const styles = css`
} }
[data-nextjs-terminal] > * { [data-nextjs-terminal] > * {
margin: 0; margin: 0;
padding: 0.5rem; padding: calc(var(--size-gap) + var(--size-gap-half))
calc(var(--size-gap-double) + var(--size-gap-half));
} }
[data-nextjs-terminal] pre { [data-nextjs-terminal] pre {
......
...@@ -3,8 +3,8 @@ import { noop as css } from '../../helpers/noop-template' ...@@ -3,8 +3,8 @@ import { noop as css } from '../../helpers/noop-template'
const styles = css` const styles = css`
[data-nextjs-toast] { [data-nextjs-toast] {
position: fixed; position: fixed;
bottom: 1rem; bottom: var(--size-gap-double);
left: 1rem; left: var(--size-gap-double);
max-width: 420px; max-width: 420px;
z-index: 9000; z-index: 9000;
} }
...@@ -18,11 +18,12 @@ const styles = css` ...@@ -18,11 +18,12 @@ const styles = css`
[data-nextjs-toast-wrapper] { [data-nextjs-toast-wrapper] {
padding: 1rem; padding: 1rem;
border-radius: 5px; border-radius: var(--size-gap-half);
font-weight: 600; font-weight: 500;
color: var(--color-ansi-white); color: var(--color-ansi-bright-white);
background-color: var(--color-ansi-red); background-color: var(--color-ansi-red);
box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.12); box-shadow: 0px var(--size-gap-double) var(--size-gap-quad)
rgba(0, 0, 0, 0.25);
} }
` `
......
...@@ -48,12 +48,14 @@ export const styles = css` ...@@ -48,12 +48,14 @@ export const styles = css`
.nextjs-container-build-error-header > h4 { .nextjs-container-build-error-header > h4 {
line-height: 1.5; line-height: 1.5;
margin: 0; margin: 0;
margin-top: 1rem; padding: 0;
} }
.nextjs-container-build-error-body,
.nextjs-container-build-error-body footer { .nextjs-container-build-error-body footer {
margin-top: 1.5rem; margin-top: var(--size-gap);
}
.nextjs-container-build-error-body footer p {
margin: 0;
} }
.nextjs-container-build-error-body small { .nextjs-container-build-error-body small {
......
...@@ -231,7 +231,7 @@ export const Errors: React.FC<ErrorsProps> = function Errors({ errors }) { ...@@ -231,7 +231,7 @@ export const Errors: React.FC<ErrorsProps> = function Errors({ errors }) {
{readyErrors.length < 2 ? '' : 's'} {readyErrors.length < 2 ? '' : 's'}
</small> </small>
</LeftRightDialogHeader> </LeftRightDialogHeader>
<h4 id="nextjs__container_errors_label">Unhandled Runtime Error</h4> <h1 id="nextjs__container_errors_label">Unhandled Runtime Error</h1>
<p id="nextjs__container_errors_desc"> <p id="nextjs__container_errors_desc">
{activeError.error.name}: {activeError.error.message} {activeError.error.name}: {activeError.error.message}
</p> </p>
...@@ -246,26 +246,35 @@ export const Errors: React.FC<ErrorsProps> = function Errors({ errors }) { ...@@ -246,26 +246,35 @@ export const Errors: React.FC<ErrorsProps> = function Errors({ errors }) {
} }
export const styles = css` export const styles = css`
.nextjs-container-errors-header > h4 { .nextjs-container-errors-header > h1 {
line-height: 1.5; font-size: var(--size-font-big);
line-height: var(--size-font-bigger);
font-weight: bold;
margin: 0; margin: 0;
margin-top: 1rem; margin-top: calc(var(--size-gap-double) + var(--size-gap-half));
} }
.nextjs-container-errors-header small { .nextjs-container-errors-header small {
color: #757575; font-size: var(--size-font-small);
margin-left: 9px; color: var(--color-accents-1);
margin-left: var(--size-gap-double);
} }
.nextjs-container-errors-header small > span { .nextjs-container-errors-header small > span {
font-family: var(--font-stack-monospace); font-family: var(--font-stack-monospace);
} }
.nextjs-container-errors-header > p { .nextjs-container-errors-header > p {
font-family: var(--font-stack-monospace); font-family: var(--font-stack-monospace);
font-size: var(--size-font-small);
line-height: var(--size-font-big);
font-weight: bold;
margin: 0; margin: 0;
color: #6a6a6a; color: var(--color-ansi-red);
} }
.nextjs-container-errors-body { .nextjs-container-errors-body > h5:not(:first-child) {
margin-top: 1.5rem; margin-top: calc(var(--size-gap-double) + var(--size-gap));
}
.nextjs-container-errors-body > h5 {
margin-bottom: var(--size-gap);
} }
.nextjs-toast-errors-parent { .nextjs-toast-errors-parent {
...@@ -281,6 +290,6 @@ export const styles = css` ...@@ -281,6 +290,6 @@ export const styles = css`
justify-content: flex-start; justify-content: flex-start;
} }
.nextjs-toast-errors > svg { .nextjs-toast-errors > svg {
margin-right: 0.5rem; margin-right: var(--size-gap);
} }
` `
...@@ -5,7 +5,7 @@ import { noop as css } from '../helpers/noop-template' ...@@ -5,7 +5,7 @@ import { noop as css } from '../helpers/noop-template'
import { getFrameSource, OriginalStackFrame } from '../helpers/stack-frame' import { getFrameSource, OriginalStackFrame } from '../helpers/stack-frame'
import { ReadyRuntimeError } from './Errors' import { ReadyRuntimeError } from './Errors'
export type RuntimeErrorProps = { className?: string; error: ReadyRuntimeError } export type RuntimeErrorProps = { error: ReadyRuntimeError }
const CallStackFrame: React.FC<{ const CallStackFrame: React.FC<{
frame: OriginalStackFrame frame: OriginalStackFrame
...@@ -80,7 +80,6 @@ const CallStackFrame: React.FC<{ ...@@ -80,7 +80,6 @@ const CallStackFrame: React.FC<{
} }
const RuntimeError: React.FC<RuntimeErrorProps> = function RuntimeError({ const RuntimeError: React.FC<RuntimeErrorProps> = function RuntimeError({
className,
error, error,
}) { }) {
const firstFirstPartyFrameIndex = React.useMemo<number>(() => { const firstFirstPartyFrameIndex = React.useMemo<number>(() => {
...@@ -134,7 +133,7 @@ const RuntimeError: React.FC<RuntimeErrorProps> = function RuntimeError({ ...@@ -134,7 +133,7 @@ const RuntimeError: React.FC<RuntimeErrorProps> = function RuntimeError({
]) ])
return ( return (
<div className={className}> <React.Fragment>
{firstFrame ? ( {firstFrame ? (
<React.Fragment> <React.Fragment>
<h5>Source</h5> <h5>Source</h5>
...@@ -176,7 +175,7 @@ const RuntimeError: React.FC<RuntimeErrorProps> = function RuntimeError({ ...@@ -176,7 +175,7 @@ const RuntimeError: React.FC<RuntimeErrorProps> = function RuntimeError({
) : ( ) : (
undefined undefined
)} )}
</div> </React.Fragment>
) )
} }
...@@ -185,30 +184,37 @@ export const styles = css` ...@@ -185,30 +184,37 @@ export const styles = css`
background: none; background: none;
border: none; border: none;
padding: 0; padding: 0;
color: rgba(25, 25, 25, 0.6); font-size: var(--size-font-small);
line-height: var(--size-font-bigger);
color: var(--color-accents-3);
}
[data-nextjs-call-stack-frame]:not(:last-child) {
margin-bottom: var(--size-gap-double);
} }
[data-nextjs-call-stack-frame] > h6 { [data-nextjs-call-stack-frame] > h6 {
margin-top: 0;
margin-bottom: var(--size-gap);
font-family: var(--font-stack-monospace); font-family: var(--font-stack-monospace);
color: rgba(25, 25, 25, 1); color: rgba(25, 25, 25, 1);
} }
[data-nextjs-call-stack-frame] > h6 > svg { [data-nextjs-call-stack-frame] > h6 > svg {
width: auto; width: auto;
height: 0.875rem; height: var(--size-font-small);
margin-right: 0.5rem; margin-right: var(--size-gap);
} }
[data-nextjs-call-stack-frame] > div { [data-nextjs-call-stack-frame] > div {
display: flex; display: flex;
align-items: center; align-items: center;
margin-bottom: 1rem; padding-left: calc(var(--size-gap) + var(--size-gap-half));
padding-left: 0.75rem; font-size: var(--size-font-small);
font-size: 0.875rem;
color: rgba(25, 25, 25, 0.5); color: rgba(25, 25, 25, 0.5);
} }
[data-nextjs-call-stack-frame] > div > svg { [data-nextjs-call-stack-frame] > div > svg {
width: auto; width: auto;
height: 0.875rem; height: var(--size-font-small);
margin-left: 0.5rem; margin-left: var(--size-gap);
display: none; display: none;
} }
......
...@@ -7,29 +7,43 @@ export function Base() { ...@@ -7,29 +7,43 @@ export function Base() {
dangerouslySetInnerHTML={{ dangerouslySetInnerHTML={{
__html: css` __html: css`
:host { :host {
--size-gap-half: 0.25rem; /* 4px */
--size-gap: 0.5rem; /* 8px */
--size-gap-double: 1rem; /* 16px */
--size-gap-quad: 2rem; /* 32px */
--size-font-small: 0.875rem; /* 14px */
--size-font: 1rem; /* 16px */
--size-font-big: 1.25rem; /* 20px */
--size-font-bigger: 1.5rem; /* 24px */
--color-accents-1: #808080;
--color-accents-2: #222222;
--color-accents-3: #404040;
--font-stack-monospace: 'SFMono-Regular', Consolas, --font-stack-monospace: 'SFMono-Regular', Consolas,
'Liberation Mono', Menlo, Courier, monospace; 'Liberation Mono', Menlo, Courier, monospace;
--color-ansi-selection: rgba(95, 126, 151, 0.48); --color-ansi-selection: rgba(95, 126, 151, 0.48);
--color-ansi-bg: #011627; --color-ansi-bg: #111111;
--color-ansi-fg: #d6deeb; --color-ansi-fg: #cccccc;
--color-ansi-white: #ffffff; --color-ansi-white: #777777;
--color-ansi-black: #011627; --color-ansi-black: #141414;
--color-ansi-blue: #82aaff; --color-ansi-blue: #00aaff;
--color-ansi-cyan: #21c7a8; --color-ansi-cyan: #88ddff;
--color-ansi-green: #22da6e; --color-ansi-green: #98ec65;
--color-ansi-magenta: #c792ea; --color-ansi-magenta: #aa88ff;
--color-ansi-red: #ef5350; --color-ansi-red: #ff5555;
--color-ansi-yellow: #addb67; --color-ansi-yellow: #ffcc33;
--color-ansi-bright-white: #ffffff; --color-ansi-bright-white: #ffffff;
--color-ansi-bright-black: #575656; --color-ansi-bright-black: #777777;
--color-ansi-bright-blue: #82aaff; --color-ansi-bright-blue: #33bbff;
--color-ansi-bright-cyan: #7fdbca; --color-ansi-bright-cyan: #bbecff;
--color-ansi-bright-green: #22da6e; --color-ansi-bright-green: #b6f292;
--color-ansi-bright-magenta: #c792ea; --color-ansi-bright-magenta: #cebbff;
--color-ansi-bright-red: #ef5350; --color-ansi-bright-red: #ff8888;
--color-ansi-bright-yellow: #ffeb95; --color-ansi-bright-yellow: #ffd966;
} }
.mono { .mono {
...@@ -42,9 +56,9 @@ export function Base() { ...@@ -42,9 +56,9 @@ export function Base() {
h4, h4,
h5, h5,
h6 { h6 {
margin-bottom: 0.5rem; margin-bottom: var(--size-gap);
font-weight: 500; font-weight: 500;
line-height: 1.2; line-height: 1.5;
} }
h1 { h1 {
......
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