Skip to content

Commit

Permalink
Merge pull request #1435 from ipfs-shipyard/bug-1434-viewerheight
Browse files Browse the repository at this point in the history
Variable viewer height
  • Loading branch information
jessicaschilling authored Apr 14, 2020
2 parents de684d7 + 634c4c8 commit dd09f39
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/files/file-preview/FilePreview.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.FilePreviewPDF {
height: calc(100vh - 140px - 5.5rem); /* 100% of viewport height, minus fixed-height search box and PDF info bar based on font height */
min-height: 100px;
}

@media only screen and (max-width: 60em) {
.FilePreviewPDF {
height: calc(100vh - 234px - 14rem); /* 100% of viewport height, minus fixed-height search box, page nav header, and PDF info bar based on font height */
}
}
3 changes: 2 additions & 1 deletion src/files/file-preview/FilePreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import isBinary from 'is-binary'
import { Trans, withTranslation } from 'react-i18next'
import typeFromExt from '../type-from-ext'
import ComponentLoader from '../../loader/ComponentLoader.js'
import './FilePreview.css'

class Preview extends React.Component {
state = {
Expand Down Expand Up @@ -32,7 +33,7 @@ class Preview extends React.Component {
)
case 'pdf':
return (
<object width='100%' height='500px' data={src} type='application/pdf'>
<object className="FilePreviewPDF w-100" data={src} type='application/pdf'>
{t('noPDFSupport')}
<a href={src} download target='_blank' rel='noopener noreferrer' className='underline-hover navy-muted'>{t('downloadPDF')}</a>
</object>
Expand Down

0 comments on commit dd09f39

Please sign in to comment.