From 595a6e0ce2a80b55a24eff0b0dd1405d6b7f1756 Mon Sep 17 00:00:00 2001 From: jackyzha0 Date: Sat, 23 May 2020 10:07:33 -0700 Subject: wip render dispatch --- frontend/src/components/ViewPaste.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'frontend/src/components/ViewPaste.js') diff --git a/frontend/src/components/ViewPaste.js b/frontend/src/components/ViewPaste.js index 914f94c..00348a5 100644 --- a/frontend/src/components/ViewPaste.js +++ b/frontend/src/components/ViewPaste.js @@ -21,11 +21,13 @@ class ViewPaste extends React.Component { error: '', passError: '', theme: 'atom', + inRenderMode: false, language: LANGS.raw, }; this.handleChange = this.handleChange.bind(this); this.typedPass = this.typedPass.bind(this); + this.toggleRender = this.toggleRender.bind(this); this.validatePass = this.validatePass.bind(this); this.ErrorLabel = React.createRef(); this.PasswordModal = React.createRef(); @@ -45,6 +47,10 @@ class ViewPaste extends React.Component { this.setState({ enteredPass: event.target.value }); } + toggleRender() { + this.setState({ isRenderMode: !this.state.isRenderMode }); + } + validatePass(pass) { FetchPasswordPaste(this.props.hash, pass) .then((response) => { @@ -73,6 +79,12 @@ class ViewPaste extends React.Component { } render() { + + // var display + // if (this.state.isRenderMode) { + + // } + return (
} - expiry={this.state.expiry} /> + />
); } -- cgit v1.2.3 From f4cb08e7a1eaebf3c60506e3a4941c903619c448 Mon Sep 17 00:00:00 2001 From: jackyzha0 Date: Sat, 23 May 2020 10:59:31 -0700 Subject: fix more styling problems --- frontend/src/components/ViewPaste.js | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'frontend/src/components/ViewPaste.js') diff --git a/frontend/src/components/ViewPaste.js b/frontend/src/components/ViewPaste.js index 00348a5..30fb29e 100644 --- a/frontend/src/components/ViewPaste.js +++ b/frontend/src/components/ViewPaste.js @@ -6,6 +6,7 @@ import PasteInfo from './PasteInfo'; import PasswordModal from './modals/PasswordModal' import { FetchPaste, FetchPasswordPaste } from '../helpers/httpHelper' import { LANGS } from './renderers/Code' +import RenderDispatch from './renderers/RenderDispatch' class ViewPaste extends React.Component { @@ -80,10 +81,23 @@ class ViewPaste extends React.Component { render() { - // var display - // if (this.state.isRenderMode) { - - // } + var display + if (this.state.isRenderMode) { + display = + + } else { + display = + + } return (
@@ -98,12 +112,7 @@ class ViewPaste extends React.Component { value={this.state.title} id="titleInput" readOnly /> - + {display}