Skip to content

Commit dd09f39

Browse files
Merge pull request #1435 from ipfs-shipyard/bug-1434-viewerheight
Variable viewer height
2 parents de684d7 + 634c4c8 commit dd09f39

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.FilePreviewPDF {
2+
height: calc(100vh - 140px - 5.5rem); /* 100% of viewport height, minus fixed-height search box and PDF info bar based on font height */
3+
min-height: 100px;
4+
}
5+
6+
@media only screen and (max-width: 60em) {
7+
.FilePreviewPDF {
8+
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 */
9+
}
10+
}

src/files/file-preview/FilePreview.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import isBinary from 'is-binary'
55
import { Trans, withTranslation } from 'react-i18next'
66
import typeFromExt from '../type-from-ext'
77
import ComponentLoader from '../../loader/ComponentLoader.js'
8+
import './FilePreview.css'
89

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

0 commit comments

Comments
 (0)