Commit f4ae99fc authored by Naoyuki Kanezawa's avatar Naoyuki Kanezawa Committed by GitHub

Revert "Add syntax highlighting to debug error page" (#197)

parent 060480f2
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
"parser": "babel-eslint" "parser": "babel-eslint"
}, },
"dependencies": { "dependencies": {
"ansi-html": "0.0.6",
"babel-core": "6.17.0", "babel-core": "6.17.0",
"babel-generator": "6.17.0", "babel-generator": "6.17.0",
"babel-loader": "6.2.5", "babel-loader": "6.2.5",
......
import React from 'react' import React from 'react'
import ansiHTML from 'ansi-html' import stripAnsi from 'strip-ansi'
import Head from 'next/head' import Head from 'next/head'
import style from 'next/css' import style from 'next/css'
...@@ -16,24 +16,20 @@ export default class ErrorDebug extends React.Component { ...@@ -16,24 +16,20 @@ export default class ErrorDebug extends React.Component {
<Head> <Head>
<style dangerouslySetInnerHTML={{ __html: ` <style dangerouslySetInnerHTML={{ __html: `
body { body {
background: #a6004c; background: #dc0067;
margin: 0; margin: 0;
} }
`}} /> `}} />
</Head> </Head>
<div className={styles.heading}>Error in {path}</div> <div className={styles.heading}>Error in {path}</div>
<pre className={styles.message} dangerouslySetInnerHTML={{ __html: ansiHTML(encodeHtml(message)) }} /> <pre className={styles.message}>{stripAnsi(message)}</pre>
</div> </div>
} }
} }
const encodeHtml = str => {
return str.replace(/</g, '&lt;').replace(/>/g, '&gt;')
}
const styles = { const styles = {
body: style({ body: style({
background: '#a6004c', background: '#dc0067',
margin: 0 margin: 0
}), }),
...@@ -54,18 +50,7 @@ const styles = { ...@@ -54,18 +50,7 @@ const styles = {
fontFamily: '-apple-system, BlinkMacSystemFont, Roboto, "Segoe UI", "Fira Sans", Avenir, "Helvetica Neue", "Lucida Grande", sans-serif', fontFamily: '-apple-system, BlinkMacSystemFont, Roboto, "Segoe UI", "Fira Sans", Avenir, "Helvetica Neue", "Lucida Grande", sans-serif',
fontSize: '13px', fontSize: '13px',
fontWeight: 'bold', fontWeight: 'bold',
color: '#ff84bf', color: '#ff90c6',
marginBottom: '20px' marginBottom: '20px'
}) })
} }
ansiHTML.setColors({
reset: ['fff', 'a6004c'],
darkgrey: '5a012b',
yellow: 'ffab07',
green: 'aeefba',
magenta: 'ff84bf',
blue: '3505a0',
cyan: '56eaec',
red: '4e053a'
})
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