diff --git a/src/assets/css/App.css b/src/assets/css/App.css index 754fc3b..d45cb27 100644 --- a/src/assets/css/App.css +++ b/src/assets/css/App.css @@ -23,7 +23,7 @@ strong { } .view-container { - width: 70%; + width: 60%; margin: 10px auto; } @@ -77,6 +77,13 @@ strong { background: #0c1a2b; } +.stick { + z-index: 2; + position: fixed; + top: 0; + width: 100%; +} + /* TOPICS */ .topic { @@ -142,6 +149,12 @@ strong { margin-right: 11.25px; } +.user-avatar { + width: 52px; + height: 52px; + text-align: center; +} + .stretch-space-between { display: flex; flex-flow: row nowrap; @@ -190,6 +203,10 @@ a { text-decoration: none; } +.post-content a{ + color: #039be5; +} + .center-in-parent { width: 100%; height: 100%; diff --git a/src/components/NavBar.js b/src/components/NavBar.js index f6b8b67..6e7c60d 100644 --- a/src/components/NavBar.js +++ b/src/components/NavBar.js @@ -1,25 +1,51 @@ -import React from 'react'; +import React, { Component } from 'react'; import { drizzleConnect } from 'drizzle-react'; import { Link } from 'react-router'; -const NavBar = (props) => { - return ( - + ); + } + + componentDidMount(){ + this.headerHeight = this.navRef.current.offsetTop; + window.addEventListener('scroll', this.handleScroll); + } + + componentWillUnmount(){ + window.removeEventListener('scroll', this.handleScroll); + } + + handleScroll(){ + if (window.pageYOffset >= this.headerHeight) { + this.navRef.current.classList.add("stick") + } else { + this.navRef.current.classList.remove("stick"); + } + } }; const mapStateToProps = state => { diff --git a/src/components/NewPost.js b/src/components/NewPost.js index 21d991d..fb0fb1a 100644 --- a/src/components/NewPost.js +++ b/src/components/NewPost.js @@ -3,6 +3,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import uuidv4 from 'uuid/v4'; +import TimeAgo from 'react-timeago'; import UserAvatar from 'react-user-avatar'; import ReactMarkdown from 'react-markdown'; @@ -18,6 +19,9 @@ class NewPost extends Component { this.validateAndPost = this.validateAndPost.bind(this); this.pushToDatabase = this.pushToDatabase.bind(this); + this.newPostOuterRef = React.createRef(); + this.subjectInputRef = React.createRef(); + this.transactionProgressText = []; this.drizzle = context.drizzle; @@ -67,8 +71,8 @@ class NewPost extends Component { handlePreviewToggle() { this.setState((prevState, props) => ({ - previewEnabled: !prevState.previewEnabled, - previewDate: this.getDate() + previewEnabled: !prevState.previewEnabled, + previewDate: this.getDate() })); } @@ -84,7 +88,7 @@ class NewPost extends Component { render() { return ( -
+
{this.state.creatingPost &&

@@ -93,58 +97,76 @@ class NewPost extends Component {
} -
- -

- {this.props.user.username}
Subject: {this.state.postSubjectInput}
-

-
- - #{this.props.postIndex} +
+
+ +
+
+
+
+ {this.props.user.username} + + {this.state.previewEnabled && + + }{this.state.previewEnabled && ","} #{this.props.postIndex} + +
+
+ + {this.state.previewEnabled && + ("Subject: " + this.state.postSubjectInput) + } + +
+
+
+ {this.state.previewEnabled + ? + : [ + , +