diff options
| author | jackyzha0 <[email protected]> | 2020-05-10 00:25:31 -0700 |
|---|---|---|
| committer | jackyzha0 <[email protected]> | 2020-05-10 00:25:31 -0700 |
| commit | 22c58b4d7d864414c599761f92212a5825003950 (patch) | |
| tree | 8a89e71ebf8c3e549f1f22cda3180eb305f4b202 /frontend/src/components/PasteArea.js | |
| parent | add title component (diff) | |
| download | ctrl-v-22c58b4d7d864414c599761f92212a5825003950.tar.xz ctrl-v-22c58b4d7d864414c599761f92212a5825003950.zip | |
input length check and component splitting
Diffstat (limited to 'frontend/src/components/PasteArea.js')
| -rw-r--r-- | frontend/src/components/PasteArea.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/frontend/src/components/PasteArea.js b/frontend/src/components/PasteArea.js index fb3db64..f026ef9 100644 --- a/frontend/src/components/PasteArea.js +++ b/frontend/src/components/PasteArea.js @@ -13,6 +13,14 @@ class PasteArea extends React.Component { this.handleSubmit = this.handleSubmit.bind(this); } + componentDidUpdate() { + if (this.state.title === "") { + document.title = `ctrl-v`; + } else { + document.title = `ctrl-v | ${this.state.title}`; + } + } + handleChange(event) { const target = event.target; const name = target.name; @@ -33,10 +41,12 @@ class PasteArea extends React.Component { <form onSubmit={this.handleSubmit}> <TitleInput onChange={this.handleChange} - value={this.state.title} /> + value={this.state.title} + maxLength="100" /> <PasteInput onChange={this.handleChange} - content={this.state.content} /> + content={this.state.content} + maxLength="100000" /> <br /> <input className="lt-button lt-shadow lt-hover" type="submit" value="new paste" /> </form> |