-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
infographics feature and code refactoring
- Loading branch information
1 parent
c1877d3
commit 8dd457a
Showing
15 changed files
with
625 additions
and
572 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import Typography from "@material-ui/core/Typography"; | ||
import { useContext } from "react"; | ||
import { CommonContext } from "../contexts/Common"; | ||
|
||
function MetaData() { | ||
const { metaData, classes } = useContext(CommonContext); | ||
if (metaData === null) { | ||
return ""; | ||
} | ||
return ( | ||
<div> | ||
{metaData && | ||
Object.keys(metaData).map((key) => ( | ||
<div key={key}> | ||
<Typography className={classes.typography}> | ||
{key}: {metaData[key]} | ||
</Typography> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
const { metaData, classes } = useContext(CommonContext); | ||
if (metaData === null) { | ||
return ""; | ||
} | ||
return ( | ||
<div> | ||
{metaData && | ||
Object.keys(metaData).map((key) => ( | ||
<div key={key} className={classes.metaData}> | ||
<span className={classes.metaWidth}>{key}</span> | ||
<span className={classes.metaDataValue}> | ||
{metaData[key]} | ||
</span> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
} | ||
export default MetaData; |
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,59 @@ | ||
import React, { useContext } from "react"; | ||
import PropTypes from "prop-types"; | ||
import Popover from "@material-ui/core/Popover"; | ||
import Typography from "@material-ui/core/Typography"; | ||
import IconButton from "@material-ui/core/IconButton"; | ||
import CloseIcon from "@material-ui/icons/Close"; | ||
import InfoIcon from "@material-ui/icons/Info"; | ||
import { CommonContext } from "../../contexts/Common"; | ||
|
||
const BiblePopover = ({ versionName, code, metaData }) => { | ||
const [open, setOpen] = React.useState(false); | ||
const { classes } = useContext(CommonContext); | ||
|
||
const handleOpen = () => { | ||
setOpen(true); | ||
}; | ||
const handleClose = () => { | ||
setOpen(false); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<InfoIcon onMouseEnter={handleOpen} /> | ||
<Popover open={open} onClose={handleClose}> | ||
<div className={classes.closeIcon}> | ||
<IconButton onClick={handleClose}> | ||
<CloseIcon /> | ||
</IconButton> | ||
</div> | ||
<Typography | ||
className={classes.typography} | ||
variant="h5" | ||
gutterBottom | ||
> | ||
{versionName} ({code}) | ||
</Typography> | ||
<hr /> | ||
<div className={classes.metaTable}> | ||
{metaData && | ||
Object.keys(metaData).map((key) => ( | ||
<div key={key} className={classes.metaData}> | ||
<span className={classes.metaWidth}>{key}</span> | ||
{metaData[key]} | ||
</div> | ||
))} | ||
</div> | ||
</Popover> | ||
</div> | ||
); | ||
}; | ||
BiblePopover.propTypes = { | ||
versionName: PropTypes.string.isRequired, | ||
code: PropTypes.string.isRequired, | ||
metaData: PropTypes.instanceOf(Object), | ||
}; | ||
BiblePopover.defaultProps = { | ||
metaData: null, | ||
}; | ||
export default BiblePopover; |
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 was deleted.
Oops, something went wrong.
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.