0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-03 17:02:40 +00:00

Convert page to functional component

This commit is contained in:
Gazook89
2024-04-13 11:10:43 -05:00
parent 6220e4f63f
commit ff84ded547

View File

@@ -1,32 +1,24 @@
require('./errorPage.less'); import './errorPage.less';
const React = require('react'); import React from 'react';
const createClass = require('create-react-class'); import UIPage from '../basePages/uiPage/uiPage.jsx';
const _ = require('lodash'); import Markdown from '../../../../shared/naturalcrit/markdown.js';
const cx = require('classnames'); import ErrorIndex from './errors/errorIndex.js';
const UIPage = require('../basePages/uiPage/uiPage.jsx'); const ErrorPage = ({ brew })=>{
const errorText = ErrorIndex({ brew })[brew.HBErrorCode.toString()] || '';
const Markdown = require('../../../../shared/naturalcrit/markdown.js'); return (
<UIPage brew={{ title: 'Crit Fail!' }}>
const ErrorIndex = require('./errors/errorIndex.js');
const ErrorPage = createClass({
displayName : 'ErrorPage',
render : function(){
const errorText = ErrorIndex(this.props)[this.props.brew.HBErrorCode.toString()] || '';
return <UIPage brew={{ title: 'Crit Fail!' }}>
<div className='dataGroup'> <div className='dataGroup'>
<div className='errorTitle'> <div className='errorTitle'>
<h1>{`Error ${this.props.brew.status || '000'}`}</h1> <h1>{`Error ${brew?.status || '000'}`}</h1>
<h4>{this.props.brew.text || 'No error text'}</h4> <h4>{brew?.text || 'No error text'}</h4>
</div> </div>
<hr /> <hr />
<div dangerouslySetInnerHTML={{ __html: Markdown.render(errorText) }} /> <div dangerouslySetInnerHTML={{ __html: Markdown.render(errorText) }} />
</div> </div>
</UIPage>; </UIPage>
} );
}); };
module.exports = ErrorPage; module.exports = ErrorPage;