import { Button } from "@material-ui/core";
import React from "react";

import useStyles from "../../useStyles";

const ViewResult = ({ result, onChangeView }) => {
  const classes = useStyles();

  const onNewSMS = (event) => {
    event.preventDefault();
    if (!onChangeView) return;
    onChangeView();
  };
  return (
    <div>
      <h2>View Result</h2>
      <ul>
        {Object.keys(result).map((key) => (
          <li key={key}>
            {key}:{result[key]}
            <br />
          </li>
        ))}
      </ul>
      <Button
        type="submit"
        fullWidth
        variant="contained"
        color="primary"
        className={classes.submit}
        onClick={onNewSMS}
      >
        Done
      </Button>
    </div>
  );
};

export default ViewResult;
