source: frontend/node_modules/@pmmmwh/react-refresh-webpack-plugin/overlay/components/RuntimeErrorHeader.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.1 KB
Line 
1const Spacer = require('./Spacer.js');
2const theme = require('../theme.js');
3
4/**
5 * @typedef {Object} RuntimeErrorHeaderProps
6 * @property {number} currentErrorIndex
7 * @property {number} totalErrors
8 */
9
10/**
11 * A fixed header that shows the total runtime error count.
12 * @param {Document} document
13 * @param {HTMLElement} root
14 * @param {RuntimeErrorHeaderProps} props
15 * @returns {void}
16 */
17function RuntimeErrorHeader(document, root, props) {
18 const header = document.createElement('div');
19 header.innerText = 'Error ' + (props.currentErrorIndex + 1) + ' of ' + props.totalErrors;
20 header.style.backgroundColor = '#' + theme.red;
21 header.style.color = '#' + theme.white;
22 header.style.fontWeight = '500';
23 header.style.height = '2.5rem';
24 header.style.left = '0';
25 header.style.lineHeight = '2.5rem';
26 header.style.position = 'fixed';
27 header.style.textAlign = 'center';
28 header.style.top = '0';
29 header.style.width = '100vw';
30 header.style.zIndex = '2';
31
32 root.appendChild(header);
33
34 Spacer(document, root, { space: '2.5rem' });
35}
36
37module.exports = RuntimeErrorHeader;
Note: See TracBrowser for help on using the repository browser.