Advertisement
Guest User

RawImageDataRender

a guest
Dec 16th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from "react";
  2. import "./anwverl_basis.css";
  3. import HtmlViewer from "../html_viewer";
  4. import { Typography, withStyles } from "@material-ui/core";
  5. import Grid from "@material-ui/core/Grid";
  6.  
  7. const styles = theme => ({
  8.     container: {
  9.         padding: 20,
  10.         '&:last-child': {
  11.             paddingTop: 0
  12.         }
  13.     },
  14.     headerContainer: {
  15.         display: 'flex',
  16.         flexDirection: 'row',
  17.         background: '#eee'
  18.     },
  19.     headerTypography: {
  20.         display: 'flex',
  21.         flexDirection: 'column',
  22.         paddingLeft: 10
  23.     },
  24.     spacer: {
  25.         flexGrow: 1
  26.     },
  27.     bookCover: {
  28.         width: 80
  29.     },
  30.     subline: {
  31.         margin:0,
  32.         padding:0
  33.     }
  34. });
  35.  
  36. const BookContentViewerComponent = ({
  37.     classes,
  38.     citation,
  39.     book,
  40.     loadBook,
  41.     loadCitations,
  42.     bookId,
  43.     citationId
  44. }) => {
  45.     return (
  46.         book.id !== 0 &&
  47.     citation.citationId !== "" && (
  48.             <React.Fragment>
  49.                 <div className={`${classes.container} ${classes.headerContainer}`}>
  50.                     <img src={book.coverImageData} alt={book.name}className={classes.bookCover}/>    
  51.                     <div className={classes.headerTypography}>
  52.                         <p className={classes.spacer}></p>
  53.                         <Typography variant="h5" component="h3" className={classes.headline}>
  54.                             {book.author}: {book.name}
  55.                         </Typography>
  56.                         <Typography variant="subtitle1" paragraph component="p" className={classes.subline}>
  57.                             {citation.description}
  58.                         </Typography>
  59.                     </div>
  60.                 </div>
  61.                 <Grid container className={classes.container}>
  62.                     <Grid item xs={12}>
  63.                         {citation.entries.map((c, i) => {
  64.                             return (
  65.                                 <React.Fragment key={i}>
  66.                                     <HtmlViewer rawHtml={c.markup} />
  67.                                 </React.Fragment>
  68.                             );
  69.                         })}
  70.                     </Grid>
  71.                 </Grid>
  72.             </React.Fragment>
  73.         )
  74.     );
  75. };
  76.  
  77. export default withStyles(styles)(BookContentViewerComponent);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement