Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from codemethis/basic-functionality
Basic functionality
- Loading branch information
Showing
8 changed files
with
202 additions
and
2,270 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import BigNumber from 'big-number'; | ||
import {prettifyNumber} from '../Utilities/utilities'; | ||
|
||
function Tooltip(props) { | ||
const b = props.tooltipBuilding; | ||
const ownedDetails = () => { | ||
if(b.owned === 0) { | ||
return ''; | ||
} | ||
|
||
let details = ''; | ||
|
||
if(b.owned > 1) { | ||
details = ( | ||
<p>{b.owned} {b.plural} are producing a total of {prettifyNumber(BigNumber(b.baseNHPT).mult(b.owned).div(10))} nanites per second.</p> | ||
); | ||
} | ||
|
||
return ( | ||
<div> | ||
<p>Each {b.name} produces {prettifyNumber(BigNumber(b.baseNHPT).div(10))} nanites per second.</p> | ||
{details} | ||
</div> | ||
); | ||
}; | ||
|
||
return ( | ||
<div id="tooltip" style={{top: props.tooltipTop}}> | ||
<h4>{b.name}</h4> | ||
<p className="description">{b.description}</p> | ||
{ownedDetails()} | ||
</div> | ||
); | ||
} | ||
|
||
Tooltip.propTypes = { | ||
tooltipTop: PropTypes.string.isRequired, | ||
tooltipBuilding: PropTypes.object.isRequired | ||
} | ||
|
||
export default Tooltip; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.