Skip to content

Commit

Permalink
Impleted useItem hook to get alias from the active item, removed unec…
Browse files Browse the repository at this point in the history
…csary prop
  • Loading branch information
wrigh393 committed Mar 22, 2021
1 parent c8e5499 commit b6866e8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/components/MessageView/MessageView.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import React from "react";
import PropTypes from "prop-types";
import { Paper, Typography, makeStyles, useTheme } from "@material-ui/core";
import EmailHeader from "../EmailHeader/";
import { useItem } from "../ItemProvider"

export default function MessageView({ datetime, userAlias, from_name, from_email, to, cc, content }) {

export default function MessageView({ datetime, from_name, from_email, to, cc, content }) {
const activeItem = useItem()
const theme = useTheme();
const useStyles = makeStyles({
"content": {
Expand All @@ -16,7 +17,7 @@ export default function MessageView({ datetime, userAlias, from_name, from_email

return (
<Paper classes={{ root: classes["Paper-root"] }}>
<EmailHeader datetime={datetime} userAlias={userAlias} from_name={from_name} from_email={from_email} to={to} cc={cc} />
<EmailHeader datetime={datetime} userAlias={activeItem.userAlias} from_name={from_name} from_email={from_email} to={to} cc={cc} />
<Paper variant="outlined" classes={{ root: classes.content }}>
{content.map((line) => (
line === "\n" ? <br /> : <Typography variant="body1">{line}</Typography>
Expand All @@ -29,8 +30,6 @@ export default function MessageView({ datetime, userAlias, from_name, from_email
MessageView.propTypes = {
/** Name of message sender. */
"from_name": PropTypes.string,
/** Account alias of message sender. */
"userAlias": PropTypes.string,
/** Date the message was sent in ISO 8601 format. */
"datetime": PropTypes.string,
/** Email address of message sender. */
Expand Down

0 comments on commit b6866e8

Please sign in to comment.