diff --git a/twistter-frontend/src/pages/user.js b/twistter-frontend/src/pages/user.js index 27a0c94..d48279b 100644 --- a/twistter-frontend/src/pages/user.js +++ b/twistter-frontend/src/pages/user.js @@ -3,122 +3,200 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import axios from 'axios'; //import '../App.css'; +// Material-UI +import withStyles from '@material-ui/core/styles/withStyles'; import { makeStyles, styled } from '@material-ui/core/styles'; import Grid from '@material-ui/core/Grid'; import Card from '@material-ui/core/Card'; import Chip from '@material-ui/core/Chip'; -import Typography from "@material-ui/core/Typography"; +import Typography from '@material-ui/core/Typography'; import AddCircle from '@material-ui/icons/AddCircle'; import TextField from '@material-ui/core/TextField'; +import Button from '@material-ui/core/Button'; +import GridList from '@material-ui/core/GridList'; +import GridListTile from '@material-ui/core/GridListTile'; +import GridListTileBar from '@material-ui/core/GridListTileBar'; // component import Userline from '../Userline'; import noImage from '../images/no-img.png'; +import Paper from '@material-ui/core/Paper'; + +const styles = { + button: { + positon: 'relative', + float: 'left', + marginLeft: 30, + marginTop: 15 + }, + paper: { + // marginLeft: "10%", + // marginRight: "10%" + } +}; const MyChip = styled(Chip)({ - margin: 2, - color: 'primary' + margin: 2, + color: 'primary' }); -class user extends Component { - state = { - profile: null, - imageUrl: null, - topics: null, - newTopic: null - }; - - handleDelete = (topic) => { - alert(`Delete topic: ${topic}!`); - } - - handleAddCircle = () => { - axios.post('/putTopic', { - topic: this.state.newTopic - }) - .then(function () { - location.reload(); - }) - .catch(function (err) { - console.log(err); - }); - } +class user extends Component { + state = { + profile: null, + imageUrl: null, + topics: null, + newTopic: null + }; - handleChange(event) { - this.setState({ - newTopic: event.target.value - }) - } + handleDelete = (topic) => { + alert(`Delete topic: ${topic}!`); + }; - componentDidMount() { - axios - .get("/user") - .then(res => { - this.setState({ - profile: res.data.credentials.handle, - imageUrl: res.data.credentials.imageUrl - }); - }) - .catch(err => console.log(err)); - axios - .get("/getAllTopics") - .then(res => { - this.setState({ - topics: res.data - }) - }) - .catch(err => console.log(err)); - } - render() { - const classes = this.props; - let profileMarkup = this.state.profile ? ( -
-
loading username...
); - + handleAddCircle = () => { + axios + .post('/putTopic', { + topic: this.state.newTopic + }) + .then(function() { + location.reload(); + }) + .catch(function(err) { + console.log(err); + }); + }; - let topicsMarkup = this.state.topics ? ( - this.state.topics.map(topic =>loading topics...
); + handleChange(event) { + this.setState({ + newTopic: event.target.value + }); + } - let imageMarkup = this.state.imageUrl ? ( -
+
loading username...
+ ); - return ( -Post
-loading topics...
+ ); + + let imageMarkup = this.state.imageUrl ? ( +Posts go here
+ //posts here
+Posts go here
+