Skip to content

Commit

Permalink
stole some styling from interactive objkts to make the pdf wider
Browse files Browse the repository at this point in the history
  • Loading branch information
Zir0h committed Dec 8, 2023
1 parent d7194b7 commit 1c30e9e
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 3 deletions.
17 changes: 17 additions & 0 deletions src/components/media-types/pdf/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.tag-view .vector {
position: absolute;
top: 50%;
left: 50%;
width: 100%;
height: 100%;
transform: translateX(-50%) translateY(-50%);
border: none;
min-height: 0;
min-width: 0;
}

.objktview .vector-container {
pointer-events: all;
width: 50%;
}

42 changes: 42 additions & 0 deletions src/components/media-types/pdf/index.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@import '@styles/layout.scss';
@import '@styles/mixins.scss';

.vector {
@include embedObjktViewSizes;
}

.display {
width: 100%;
display: block;
margin: 0 auto;
border: none;
pointer-events: none;
}

.container {
position: relative;
display: block;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
pointer-events: none;
overflow: hidden;

&:after {
content: '';
display: block;
padding-bottom: 100%;
}

&.interactive {
pointer-events: all;
}

iframe {
position: absolute;
width: 100%;
height: 100%;
border: none;
}
}
14 changes: 11 additions & 3 deletions src/components/media-types/pdf/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { memo, } from 'react'
import { MediaTypeProps } from '@types'
import { ImageComponent } from '../image'
import classnames from 'classnames'
import styles from '@style'

export const PdfComponent = memo(function ({
artifactUri,
Expand All @@ -9,6 +11,14 @@ export const PdfComponent = memo(function ({
displayView,
nft,
}: MediaTypeProps) {

const classes = classnames({
[styles.container]: true,
[styles.interactive]: displayView,
[styles.display]: displayView,
})


const cover = (
<>
<ImageComponent
Expand All @@ -23,12 +33,10 @@ export const PdfComponent = memo(function ({
)
if (!displayView) return cover
return (
<div>
<div className={classes}>
<iframe
title={`PDF ${nft.token_id}`}
src={import.meta.env.VITE_IFRAME_URL + `/pdf/?pdfSrc=${artifactUri}`}
height={'500vh'}
width={'500vw'}
/>
</div>
)
Expand Down

0 comments on commit 1c30e9e

Please sign in to comment.