diff --git a/twistter-frontend/src/Writing_Microblogs.js b/twistter-frontend/src/Writing_Microblogs.js new file mode 100644 index 0000000..ed90ab6 --- /dev/null +++ b/twistter-frontend/src/Writing_Microblogs.js @@ -0,0 +1,72 @@ +import React, { Component } from "react"; +import { BrowserRouter as Router } from 'react-router-dom'; +import Route from 'react-router-dom/Route'; + + +class Writing_Microblogs extends Component { + + constructor(props) { + super(props); + this.state = { + value: '', + title: '', + characterCount: 10 + + }; + + + this.handleChange = this.handleChange.bind(this); + this.handleSubmit = this.handleSubmit.bind(this); + this.handleChangeforPost = this.handleChangeforPost.bind(this); + } + + handleChange(event) { + this.setState( {title: event.target.value }); + } + + handleSubmit(event) { + alert('A title for the microblog was inputted: ' + this.state.title + '\nA microblog was posted: ' + this.state.value); + event.preventDefault(); + } + + handleChangeforPost(event) { + this.setState({value: event.target.value }) + } + + handleChangeforCharacterCount(event) { + const charCount = event.target.value.length + const charRemaining = 10 - charCount + this.setState({characterCount: charRemaining }) + } + + + render() { + return ( +
+
+
+ +
+
+ +
+
+