Skip to content

Commit

Permalink
chore: react-19 compatibility (#14)
Browse files Browse the repository at this point in the history
## Background

Adding support for React 19

## Changes

- [x] Update types
- [x] Update rollup
- [x] Update dependencies
- [x] Swap yarn for npm
- [x] Add Github action

## Notes

@simplepdf/react-embed-pdf@1.8.4 was published as part of this PR
  • Loading branch information
bendersej authored Jan 12, 2025
1 parent 2a83391 commit 2def18a
Show file tree
Hide file tree
Showing 10 changed files with 2,276 additions and 1,167 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/react.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: React

on:
push:
branches:
- main
paths:
- react/**
- .github/workflows/react.yaml
pull_request:
branches:
- main
paths:
- react/**
- .github/workflows/react.yaml

jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: react

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"

- name: Install dependencies
run: npm ci

- name: Test formatting
run: npm run test:format

- name: Test types
run: npm run test:types
8 changes: 8 additions & 0 deletions react/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
dist/
dev/

package-lock.json

.prettierignore
.prettierrc
.DS_Store
36 changes: 36 additions & 0 deletions react/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"parser": "typescript",
"overrides": [
{
"files": "*.scss",
"options": {
"parser": "scss"
}
},
{
"files": "*.json",
"options": {
"parser": "json"
}
},
{
"files": "*.html",
"options": {
"parser": "html"
}
},
{
"files": "*.md",
"options": {
"parser": "markdown"
}
}
]
}
12 changes: 5 additions & 7 deletions react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,10 @@ While the component does not require any account to be used (without any limits)
_Example_

```jsx
import { EmbedPDF } from "@simplepdf/react-embed-pdf";
import { EmbedPDF } from '@simplepdf/react-embed-pdf';

<EmbedPDF companyIdentifier="yourcompany">
<a href="https://cdn.simplepdf.com/simple-pdf/assets/sample.pdf">
Opens sample.pdf
</a>
<a href="https://cdn.simplepdf.com/simple-pdf/assets/sample.pdf">Opens sample.pdf</a>
</EmbedPDF>;
```

Expand Down Expand Up @@ -111,15 +109,15 @@ import { EmbedPDF } from "@simplepdf/react-embed-pdf";
Specify `react-viewer` as `companyIdentifier` to disable the editing features:

```jsx
import { EmbedPDF } from "@simplepdf/react-embed-pdf";
import { EmbedPDF } from '@simplepdf/react-embed-pdf';

// The PDF is displayed using the viewer: all editing features are disabled
<EmbedPDF
<EmbedPDF
companyIdentifier="react-viewer"
mode="inline"
style={{ width: 900, height: 800 }}
documentURL="https://cdn.simplepdf.com/simple-pdf/assets/sample.pdf"
/>
/>;
```

### <a id="available-props"></a>Available props
Expand Down
Loading

0 comments on commit 2def18a

Please sign in to comment.