mirror of
https://github.com/tomru/pdfer.git
synced 2026-03-03 06:27:19 +01:00
add clear button
This commit is contained in:
@@ -3,8 +3,8 @@ header h1 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
display: block;
|
margin-top: 12px;
|
||||||
margin-top: 1em;
|
margin-right: 12px;
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,26 @@ import {generatePdf, getLatest} from './apiHelper';
|
|||||||
|
|
||||||
import './App.css';
|
import './App.css';
|
||||||
|
|
||||||
|
const DEFAULT_OPTIONS = Object.freeze({
|
||||||
|
template: 'brief-fam',
|
||||||
|
subject: '',
|
||||||
|
yourRef: '',
|
||||||
|
yourRefName: '',
|
||||||
|
yourMail: '',
|
||||||
|
myRef: '',
|
||||||
|
customer: '',
|
||||||
|
invoice: '',
|
||||||
|
date: '',
|
||||||
|
signature: '',
|
||||||
|
specialMail: '',
|
||||||
|
address: '',
|
||||||
|
opening: '',
|
||||||
|
body: '',
|
||||||
|
closing: '',
|
||||||
|
ps: '',
|
||||||
|
enclosing: '',
|
||||||
|
});
|
||||||
|
|
||||||
class App extends Component {
|
class App extends Component {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this._getLatest();
|
this._getLatest();
|
||||||
@@ -23,6 +43,7 @@ class App extends Component {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Button onClick={this._onGenerate.bind(this)} text="Backe PDF"/>
|
<Button onClick={this._onGenerate.bind(this)} text="Backe PDF"/>
|
||||||
|
<Button onClick={this._onClear.bind(this)} text="Alles Löschen"/>
|
||||||
<Preview
|
<Preview
|
||||||
pdfUrl={state.pdfUrl}
|
pdfUrl={state.pdfUrl}
|
||||||
pdfIsLoading={state.pdfIsLoading}
|
pdfIsLoading={state.pdfIsLoading}
|
||||||
@@ -37,6 +58,13 @@ class App extends Component {
|
|||||||
this.setState({options: Object.assign({}, selectedOptions)});
|
this.setState({options: Object.assign({}, selectedOptions)});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_onClear() {
|
||||||
|
this.setState({
|
||||||
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
||||||
|
pdfUrl: null,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
_onGenerate() {
|
_onGenerate() {
|
||||||
const state = this.state || {};
|
const state = this.state || {};
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|||||||
Reference in New Issue
Block a user