Skip to content

Commit

Permalink
from preview pdf to download pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyubinhan committed Nov 22, 2018
1 parent 0ce7879 commit bbd1ff0
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"react": "^16.6.1",
"react-dom": "^16.6.1",
"react-loadable": "^5.5.0",
"react-pdf": "^3.0.5",
"react-pdf": "^3.0.6",
"react-redux": "^5.1.0",
"react-router-dom": "^4.3.1",
"react-scripts": "2.1.1",
Expand Down
24 changes: 18 additions & 6 deletions src/components/rangeUsePlan/PDFView.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ class PDFView extends Component {
const { planId, agreementId } = match.params;

if (planId && agreementId) {
fetchRupPDF(planId);
fetchRupPDF(planId).then(() => {
this.onDownloadClicked();
});
}
}

Expand Down Expand Up @@ -64,7 +66,7 @@ class PDFView extends Component {
/>
),
);

return (
<section className="rup-pdf">
<a
Expand All @@ -84,8 +86,19 @@ class PDFView extends Component {
message="Error occured while fetching pdf."
/>
}

{ planPDFBlob &&
<div>
If your download does not begin, please click the button to try again.
<Button
style={{ marginLeft: '10px' }}
onClick={this.onDownloadClicked}
>
<Icon name="print" />
Download PDF
</Button>
</div>
}
{/* { planPDFBlob &&
<div className="rup-pdf__content">
<div className="rup-pdf__preview__header">
<div>
Expand All @@ -102,14 +115,13 @@ class PDFView extends Component {
<div className="rup-pdf__preview">
<Document
file={planPDFBlob}
loading={<Loading />}
// loading={<Loading />}
onLoadSuccess={this.onLoadSuccess}
>
{pages}
</Document>
</div>
</div>
}
</div> */}
</section>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/constants/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const AGREEMENT_SEARCH_PLACEHOLDER = 'Enter RAN, agreement holder\'s name
export const INITIAL_PLAN = 'Initial Plan';

// RUP View
export const PREVIEW_PDF = 'Preview PDF';
export const PREVIEW_PDF = 'Download PDF';
export const UPDATE_STATUS = 'Update Status';
export const SAVE_DRAFT = 'Save Draft';
export const SUBMIT = 'Submit';
Expand Down
3 changes: 2 additions & 1 deletion src/styles/Rup.scss
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,15 @@ $sticky-height: 55px;
.rup-pdf {
display: flex;
justify-content: center;

&__link {
display: none;
}
&__content {
display: flex;
flex-direction: column;
margin: 10px 0;
min-width: 70%;
}
&__preview {
&__header {
Expand Down

0 comments on commit bbd1ff0

Please sign in to comment.