Skip to content

Commit

Permalink
feat: import css from CDN (#8)
Browse files Browse the repository at this point in the history
---------
Co-authored-by: Marcus Schiesser <[email protected]>
  • Loading branch information
thucpn authored Nov 1, 2024
1 parent 3802136 commit 988e965
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/empty-singers-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@llamaindex/pdf-viewer': minor
---

extract css
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ npm install @llamaindex/pdf-viewer
```jsx
import React from 'react';

import '@llamaindex/pdf-viewer/index.css';
import { PDFViewer, PdfFocusProvider } from '@llamaindex/pdf-viewer';

const file = {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"source": "./src/index.ts",
"types": "./dist/cjs/index.d.ts",
"exports": {
"./index.css": "./dist/esm/view/index.css",
".": {
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
Expand Down
1 change: 0 additions & 1 deletion src/view/PDFViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import usePDFViewer from '../hooks/usePdfViewer.js';
import type { PdfDocument } from '../types/document.js';
import MemoizedVirtualizedPDF from './VirtualizedPdf.js';
import PDFOptionsBar from './PdfOptionsBar.js';
import './index.css';
import { clsx } from 'clsx';

interface PDFViewerProps {
Expand Down
2 changes: 0 additions & 2 deletions src/view/VirtualizedPdf.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import type { CSSProperties } from 'react';
import React, { forwardRef, memo, useCallback, useEffect, useRef, useState } from 'react';
import { useInView } from 'react-intersection-observer';
import { Document, Page, pdfjs } from 'react-pdf';
import 'react-pdf/dist/esm/Page/AnnotationLayer.css';
import 'react-pdf/dist/esm/Page/TextLayer.css';
import { VariableSizeList as List } from 'react-window';
import { multiHighlight } from '../utils/multi-line-highlight.js';
import { usePdfFocus } from '../hooks/usePdfFocus.js';
Expand Down
3 changes: 3 additions & 0 deletions src/view/index.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@import '~react-pdf/dist/esm/Page/AnnotationLayer.css';
@import '~react-pdf/dist/esm/Page/TextLayer.css';

.pdf-viewer-container {
display: flex;
flex-direction: column;
Expand Down

0 comments on commit 988e965

Please sign in to comment.