Skip to content

Commit 02968ec

Browse files
bvaughngaearon
authored andcommitted
Cleaned up next/prev error arrow styles; arrows wrap around when clicked now (#2210)
1 parent 0d0536f commit 02968ec

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

packages/react-error-overlay/src/overlay.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,14 @@ function renderErrorByIndex(index: number) {
110110
}
111111

112112
function switchError(offset) {
113-
const nextView = currReferenceIndex + offset;
114-
if (nextView < 0 || nextView >= errorReferences.length) {
115-
return;
113+
let nextView = currReferenceIndex + offset;
114+
115+
if (nextView < 0) {
116+
nextView = errorReferences.length - 1;
117+
} else if (nextView >= errorReferences.length) {
118+
nextView = 0;
116119
}
120+
117121
renderErrorByIndex(nextView);
118122
}
119123

packages/react-error-overlay/src/styles.js

+13-18
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
const black = '#293238',
33
darkGray = '#878e91',
44
red = '#ce1126',
5+
redTransparent = 'rgba(206, 17, 38, 0.05)',
56
lightRed = '#fccfcf',
67
yellow = '#fbf5b4',
8+
yellowTransparent = 'rgba(251, 245, 180, 0.3)',
79
white = '#ffffff';
810

911
const iframeStyle = {
@@ -122,26 +124,21 @@ const omittedFramesExpandedStyle = {
122124
'margin-bottom': '0.6em',
123125
};
124126

125-
const primaryPreStyle = {
127+
const _preStyle = {
126128
display: 'block',
127129
padding: '0.5em',
128130
'margin-top': '0.5em',
129131
'margin-bottom': '0.5em',
130132
'overflow-x': 'auto',
131133
'white-space': 'pre-wrap',
132134
'border-radius': '0.25rem',
133-
'background-color': 'rgba(206, 17, 38, .05)',
134-
};
135-
const secondaryPreStyle = {
136-
display: 'block',
137-
padding: '0.5em',
138-
'margin-top': '0.5em',
139-
'margin-bottom': '0.5em',
140-
'overflow-x': 'auto',
141-
'white-space': 'pre-wrap',
142-
'border-radius': '0.25rem',
143-
'background-color': 'rgba(251, 245, 180,.3)',
144135
};
136+
const primaryPreStyle = Object.assign({}, _preStyle, {
137+
'background-color': redTransparent,
138+
});
139+
const secondaryPreStyle = Object.assign({}, _preStyle, {
140+
'background-color': yellowTransparent,
141+
});
145142

146143
const toggleStyle = {
147144
'margin-bottom': '1.5em',
@@ -162,25 +159,23 @@ const groupStyle = {
162159
};
163160

164161
const _groupElemStyle = {
165-
'background-color': 'inherit',
166-
'border-color': '#ddd',
167-
'border-width': '1px',
162+
'background-color': redTransparent,
163+
color: red,
164+
border: 'none',
168165
'border-radius': '4px',
169-
'border-style': 'solid',
170166
padding: '3px 6px',
171167
cursor: 'pointer',
172168
};
173169

174170
const groupElemLeft = Object.assign({}, _groupElemStyle, {
175171
'border-top-right-radius': '0px',
176172
'border-bottom-right-radius': '0px',
177-
'margin-right': '0px',
173+
'margin-right': '1px',
178174
});
179175

180176
const groupElemRight = Object.assign({}, _groupElemStyle, {
181177
'border-top-left-radius': '0px',
182178
'border-bottom-left-radius': '0px',
183-
'margin-right': '-1px',
184179
});
185180

186181
const footerStyle = {

0 commit comments

Comments
 (0)