0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-20 20:24:52 +00:00

Convert LockNotification.jsx to functional component

This commit is contained in:
Trevor Buckner
2024-06-04 14:53:19 -04:00
parent 99ff7fdf14
commit 7272544724

View File

@@ -1,40 +1,29 @@
require('./lockNotification.less'); require('./lockNotification.less');
const React = require('react'); const React = require('react');
const createClass = require('create-react-class');
const LockNotification = createClass({ function LockNotification(props) {
displayName : 'LockNotification', props = {
shareId : 0,
disableLock : ()=>{},
...props
}
getDefaultProps : function() { const removeLock = () => {
return { alert(`Not yet implemented - ID ${props.shareId}`);
shareId : 0
}; };
},
getInitialState : function() {
return {
disableLock : ()=>{}
};
},
removeLock : function() {
alert(`Not yet implemented - ID ${this.props.shareId}`);
},
render : function(){
return <div className='lockNotification'> return <div className='lockNotification'>
<h1>BREW LOCKED</h1> <h1>BREW LOCKED</h1>
<p>This brew been locked by the Administrators. It will not be accessible by any method other than the Editor until the lock is removed.</p> <p>This brew been locked by the Administrators. It will not be accessible by any method other than the Editor until the lock is removed.</p>
<hr /> <hr />
<h3>LOCK REASON</h3> <h3>LOCK REASON</h3>
<p>{this.props.message || 'Unable to retrieve Lock Message'}</p> <p>{props.message || 'Unable to retrieve Lock Message'}</p>
<hr /> <hr />
<p>Once you have resolved this issue, click REQUEST LOCK REMOVAL to notify the Administrators for review.</p> <p>Once you have resolved this issue, click REQUEST LOCK REMOVAL to notify the Administrators for review.</p>
<p>Click CONTINUE TO EDITOR to temporarily hide this notification; it will reappear the next time the page is reloaded.</p> <p>Click CONTINUE TO EDITOR to temporarily hide this notification; it will reappear the next time the page is reloaded.</p>
<button onClick={this.props.disableLock}>CONTINUE TO EDITOR</button> <button onClick={props.disableLock}>CONTINUE TO EDITOR</button>
<button onClick={this.removeLock}>REQUEST LOCK REMOVAL</button> <button onClick={removeLock}>REQUEST LOCK REMOVAL</button>
</div>; </div>;
} };
});
module.exports = LockNotification; module.exports = LockNotification;