0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-27 05:02:43 +00:00

Shift renderUiItems to function

This commit is contained in:
G.Ambatte
2022-09-26 00:35:12 +13:00
parent be25e90009
commit ed5bef27e0
2 changed files with 16 additions and 14 deletions

View File

@@ -18,7 +18,7 @@ const AccountPage = createClass({
getDefaultProps : function() {
return {
brew : {},
uiItems : []
uiItems : {}
};
},
getInitialState : function() {
@@ -39,14 +39,14 @@ const AccountPage = createClass({
},
renderUiItems : function() {
// console.log(JSON.stringify(this.props.uiItems));
// console.log(this.props.uiItems);
return <>
<h1>Account Information <i className='fas fa-user'></i></h1>
<p><strong>Username: </strong> {this.props.uiItems.username || 'No user currently logged in'}</p>
<p><strong>Last Login: </strong> {this.props.uiItems.issued || '-'}</p>
<p><strong>Last Login: </strong> {this.props.uiItems.issued.toString() || '-'}</p>
<p></p>
<h3>MongoDB Information</h3>
<p><strong>Brews on MongoDB: </strong> {this.props.uiItems.mongoCount || '-'}</p>
<h3>Homebrewery Information</h3>
<p><strong>Brews on Homebrewery: </strong> {this.props.uiItems.mongoCount || '-'}</p>
<p></p>
<h3>Google Information <i className='fa-brands fa-google-drive'></i></h3>
<p><strong>Linked to Google: </strong> {this.props.uiItems.googleId ? 'YES' : 'NO'}</p>
@@ -55,7 +55,7 @@ const AccountPage = createClass({
},
render : function(){
return <UIPage brew={this.props.brew} uiItems={this.renderUiItems()} ></UIPage>;
return <UIPage brew={this.props.brew} renderUiItems={this.renderUiItems} ></UIPage>;
}
});

View File

@@ -13,13 +13,15 @@ const UIPage = createClass({
getDefaultProps : function(){
return {
uiItems : <>
<h1>H1 Header</h1>
<h2>H2 Header</h2>
<h3>H3 Header</h3>
<h4>H4 Header</h4>
<p>This is some test text.</p>
</>
renderUiItems : ()=>{
return <>
<h1>H1 Header</h1>
<h2>H2 Header</h2>
<h3>H3 Header</h3>
<h4>H4 Header</h4>
<p>This is some test text.</p>
</>;
}
};
},
@@ -37,7 +39,7 @@ const UIPage = createClass({
</Navbar>
<div className='content'>
{this.props.uiItems}
{this.props.renderUiItems()}
</div>
</div>;
}