81 lines
2.7 KiB
81 lines
2.7 KiB
import React from "react"; |
|
import PictureAsPdfRoundedIcon from "@material-ui/icons/PictureAsPdfRounded"; |
|
import "./index.scss"; |
|
import { Link } from "react-router-dom"; |
|
const maxDesktopSize = 1250; |
|
const maxMobileSize = 550; |
|
|
|
const fontSize = { |
|
desktop: { |
|
h2: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 100, |
|
div: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 100, |
|
h3: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 80, |
|
}, |
|
mobile: { |
|
h2: window.innerWidth > maxMobileSize ? 13 : window.innerWidth / 30, |
|
div: window.innerWidth > maxMobileSize ? 13 : window.innerWidth / 30, |
|
h3: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 25, |
|
}, |
|
}; |
|
|
|
export default function PDF(props) { |
|
return ( |
|
<> |
|
{window.innerWidth > 1000 ? ( |
|
<Link to={`pdf/${props.data.fileIds}`} className="d-flex flex-column"> |
|
<h3 style={{ fontSize: fontSize.desktop.h3 }}> |
|
<PictureAsPdfRoundedIcon style={{ fontSize: 30 }} /> فایل PDF |
|
</h3> |
|
<a |
|
className="pdf-box d-flex flex-column" |
|
id="pdf" |
|
target="_blank" |
|
rel="noreferrer" |
|
href={`https://dnvn.ir/xpdf/${props.data.fileIds}`} |
|
> |
|
<h2 |
|
style={{ fontSize: fontSize.desktop.h2 }} |
|
className="d-flex align-items-center" |
|
> |
|
<span></span> |
|
{props.data.name} |
|
</h2> |
|
<div style={{ fontSize: fontSize.desktop.div }}> |
|
برای دانلود این فایل روی اینجا کلیک کن |
|
</div> |
|
</a> |
|
</Link> |
|
) : null} |
|
{window.innerWidth < 1000 ? ( |
|
<Link |
|
to={`pdf/${props.data.fileIds}`} |
|
className="d-flex flex-column" |
|
// onClick={() => { |
|
// window.location = `https://dnvn.ir/xpdf/${props.data.fileIds}`; |
|
// }} |
|
> |
|
<h3 style={{ fontSize: fontSize.mobile.h3 }}> |
|
<PictureAsPdfRoundedIcon style={{ fontSize: 30 }} /> فایل PDF |
|
</h3> |
|
<div className="mobile-pdf-box d-flex flex-column"> |
|
<h2 |
|
style={{ fontSize: fontSize.mobile.h2 }} |
|
className="d-flex align-items-center" |
|
> |
|
<span></span> |
|
{props.data.name} |
|
</h2> |
|
{/* <a |
|
target="_blank" |
|
rel="noreferrer" |
|
href={`https://dnvn.ir/xpdf/${props.data.fileIds}`} |
|
style={{ fontSize: fontSize.mobile.div }} |
|
> |
|
دریافت فایل |
|
</a> */} |
|
</div> |
|
</Link> |
|
) : null} |
|
</> |
|
); |
|
}
|
|
|