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