From e13e630cd6e4fc0b1ff92098a28a770794c7bb9a Mon Sep 17 00:00:00 2001 From: gabrhr <73925454+gabrhr@users.noreply.github.com> Date: Wed, 20 Apr 2022 10:19:29 -0500 Subject: =?UTF-8?q?A=C3=B1adir=20plantilla?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Base para front --- .../app/components/SocialMedia/Timeline.js | 177 +++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 front/odiparpack/app/components/SocialMedia/Timeline.js (limited to 'front/odiparpack/app/components/SocialMedia/Timeline.js') diff --git a/front/odiparpack/app/components/SocialMedia/Timeline.js b/front/odiparpack/app/components/SocialMedia/Timeline.js new file mode 100644 index 0000000..e46826b --- /dev/null +++ b/front/odiparpack/app/components/SocialMedia/Timeline.js @@ -0,0 +1,177 @@ +import React, { Fragment } from 'react'; +import PropTypes from 'prop-types'; +import { withStyles } from '@material-ui/core/styles'; +import FavoriteIcon from '@material-ui/icons/Favorite'; +import ShareIcon from '@material-ui/icons/Share'; +import CommentIcon from '@material-ui/icons/Comment'; +import MoreVertIcon from '@material-ui/icons/MoreVert'; +import { + Typography, + Card, + Menu, + MenuItem, + CardHeader, + CardMedia, + CardContent, + CardActions, + IconButton, + Icon, + Avatar, + Tooltip, +} from '@material-ui/core'; +import Comment from './Comment'; +import styles from './jss/timeline-jss'; + + +const optionsOpt = [ + 'Option 1', + 'Option 2', + 'Option 3', +]; + +const ITEM_HEIGHT = 48; + +class Timeline extends React.Component { + state = { + anchorElOpt: null, + openComment: false, + }; + + handleClickOpt = event => { + this.setState({ anchorElOpt: event.currentTarget }); + }; + + handleCloseOpt = () => { + this.setState({ anchorElOpt: null }); + }; + + handleOpenComment = (data) => { + this.props.fetchComment(data); + this.setState({ openComment: true }); + }; + + handleCloseComment = () => { + this.setState({ openComment: false }); + }; + + render() { + const { + classes, + dataTimeline, + onlike, + commentIndex, + submitComment, + } = this.props; + const { anchorElOpt, openComment } = this.state; + const getItem = dataArray => dataArray.map(data => ( +
  • +
    + + + {data.get('icon')} + + +
    + + + } + action={( + + + + )} + title={data.get('name')} + subheader={data.get('date')} + /> + { data.get('image') !== '' + && ( + + ) + } + + + {data.get('content')} + + + + onlike(data)}> + + + + + +
    + + {data.get('comments') !== undefined ? data.get('comments').size : 0} + + this.handleOpenComment(data)}> + + +
    +
    +
    +
  • + )); + return ( + + + {optionsOpt.map(option => ( + + {option} + + ))} + + + + + ); + } +} + +Timeline.propTypes = { + classes: PropTypes.object.isRequired, + onlike: PropTypes.func, + dataTimeline: PropTypes.object.isRequired, + fetchComment: PropTypes.func, + submitComment: PropTypes.func, + commentIndex: PropTypes.number, +}; + +Timeline.defaultProps = { + onlike: () => (false), + fetchComment: () => {}, + submitComment: () => {}, + commentIndex: 0, +}; + +export default withStyles(styles)(Timeline); -- cgit v1.2.3