mirror of
https://github.com/tomru/pdfer.git
synced 2026-03-03 14:37:21 +01:00
add clear button
This commit is contained in:
@@ -3,8 +3,8 @@ header h1 {
|
||||
}
|
||||
|
||||
button {
|
||||
display: block;
|
||||
margin-top: 1em;
|
||||
margin-top: 12px;
|
||||
margin-right: 12px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,26 @@ import {generatePdf, getLatest} from './apiHelper';
|
||||
|
||||
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 {
|
||||
componentDidMount() {
|
||||
this._getLatest();
|
||||
@@ -23,6 +43,7 @@ class App extends Component {
|
||||
</div>
|
||||
<div>
|
||||
<Button onClick={this._onGenerate.bind(this)} text="Backe PDF"/>
|
||||
<Button onClick={this._onClear.bind(this)} text="Alles Löschen"/>
|
||||
<Preview
|
||||
pdfUrl={state.pdfUrl}
|
||||
pdfIsLoading={state.pdfIsLoading}
|
||||
@@ -37,6 +58,13 @@ class App extends Component {
|
||||
this.setState({options: Object.assign({}, selectedOptions)});
|
||||
}
|
||||
|
||||
_onClear() {
|
||||
this.setState({
|
||||
options: Object.assign({}, DEFAULT_OPTIONS),
|
||||
pdfUrl: null,
|
||||
});
|
||||
}
|
||||
|
||||
_onGenerate() {
|
||||
const state = this.state || {};
|
||||
this.setState({
|
||||
|
||||
Reference in New Issue
Block a user