Skip to content

Commit

Permalink
fix pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
adase11 committed Oct 6, 2024
1 parent aed1905 commit 49d2e08
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/components/Projects/Cell.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import dayjs from 'dayjs';
import React from 'react';
import { IProject } from '../../data/projects';
import PdfViewer from './Pdf';
import PdfViewer from './PdfViewer';

export interface ICell {
data: IProject;
Expand Down Expand Up @@ -32,7 +32,7 @@ const Cell: React.FC<ICell> = ({ data }) => (
) : (
<div></div>
)}
{data.pdf ? PdfViewer(data.pdf) : <div></div>}
{data.pdf ? <PdfViewer path={data.pdf}></PdfViewer> : <div></div>}
<div className="description">
<p>{data.desc}</p>
</div>
Expand Down
17 changes: 0 additions & 17 deletions src/components/Projects/Pdf.tsx

This file was deleted.

17 changes: 17 additions & 0 deletions src/components/Projects/PdfViewer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Viewer, Worker } from '@react-pdf-viewer/core';
import '@react-pdf-viewer/core/lib/styles/index.css';
import React from 'react';

export interface IPdf {
path: string;
}

const PdfViewer: React.FC<IPdf> = ({ path }) => (
<div style={{ height: '750px' }}>
<Worker workerUrl="https://unpkg.com/[email protected]/build/pdf.worker.min.js">
<Viewer fileUrl={path} />;
</Worker>
</div>
);

export default PdfViewer;
4 changes: 3 additions & 1 deletion src/components/Template/Hamburger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ const Hamburger = () => {
{routes.map((l) => (
<li key={l.label}>
<Link to={l.path} onClick={() => setOpen(!open)}>
<h3 className={l.index && 'index-li'}>{l.label}</h3>
<h3 className={l.index ? 'index-li' : undefined}>
{l.label}
</h3>
</Link>
</li>
))}
Expand Down

0 comments on commit 49d2e08

Please sign in to comment.