Skip to content

Commit

Permalink
release 1.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
smastrom committed Aug 17, 2023
1 parent f300af3 commit 4afbd6a
Show file tree
Hide file tree
Showing 10 changed files with 1,301 additions and 913 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
build:
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
os: [macos-latest, ubuntu-latest]

runs-on: ${{ matrix.os }}
steps:
Expand All @@ -16,7 +16,7 @@ jobs:
node-version: '18.x'
- uses: pnpm/action-setup@v2
with:
version: 7
version: 8
- name: Install dependencies
run: pnpm install
- name: Build package
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Tests

on: [push, pull_request]
on: [push]

jobs:
tests:
Expand All @@ -12,7 +12,7 @@ jobs:
node-version: '18.x'
- uses: pnpm/action-setup@v2
with:
version: 7
version: 8
- name: Install dependencies
run: pnpm install
- name: Install Playwright
Expand Down
90 changes: 68 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Zero dependency, highly customizable rating component for React.

![react-rating](https://i.ibb.co/L6M0hfw/new.png)

[Demo and Examples](https://react-rating.onrender.com/)[NextJS SSR](https://stackblitz.com/edit/nextjs-5qw9id?file=pages/index.tsx)[Vite](https://stackblitz.com/edit/vitejs-vite-gwqytd?file=src/App.tsx)
[Demo and Examples](https://react-rating.onrender.com/)[NextJS Page Router](https://stackblitz.com/edit/nextjs-5qw9id?file=pages/index.tsx)[Vite](https://stackblitz.com/edit/vitejs-vite-gwqytd?file=src/App.tsx)

<br />

Expand Down Expand Up @@ -71,7 +71,7 @@ export default function App() {
// ...
```
**in any page/component:**
**in any page.tsx**
```tsx
import { Rating } from '@smastrom/react-rating';
Expand All @@ -82,77 +82,123 @@ export default function Index() {
</details>
<details><summary><strong>Next</strong></summary>
<details><summary><strong>NextJS 13 - App Router</strong></summary>
<br />
### Interactive rating
**pages/\_app.js**
**app/layout.tsx**
```jsx
import '@smastrom/react-rating/style.css';
```tsx
import '@smastrom/react-rating/style.css'
```
function MyApp({ Component, pageProps }) {
// ...
**components/Rating.tsx**
```tsx
'use client'

import { useState } from 'react'
import { Rating as ReactRating } from '@smastrom/react-rating'

export function Rating() {
const [rating, setRating] = useState(0)

return <ReactRating style={{ maxWidth: 100 }} value={rating} onChange={setRating} />
}
```
**in any page/component:**
```tsx
import { Rating } from '@smastrom/react-rating';
import { Rating } from './components/Rating'

export default function Home() {
// ...
return (
<div>
{/* Other nodes... */}
<Rating />
{/* Other nodes... */}
</div>
)
}
```
### Non-interactive rating
**app/layout.tsx**
```tsx
import '@smastrom/react-rating/style.css'
```
**in any page/component:**
```tsx
import { Rating } from '@smastrom/react-rating'

export default function Home() {
return (
<div>
{/* Other nodes... */}
<Rating style={{ maxWidth: 100 }} value={3} readOnly />
{/* Other nodes... */}
</div>
)
}
```
</details>
<details><summary><strong>Gatsby</strong></summary>
<details><summary><strong>NextJS - Pages Router</strong></summary>
<br />
**gatsby-browser.js** - Create the file at the root of your project if it doesn't exist, and relaunch the dev server.
**pages/\_app.js**
```jsx
import '@smastrom/react-rating/style.css'
import '@smastrom/react-rating/style.css';

function MyApp({ Component, pageProps }) {
// ...
```
**in any page/component:**
```tsx
import { Rating } from '@smastrom/react-rating';

const IndexPage = () => {
export default function Home() {
// ...
```
</details>
<details><summary><strong>Vite</strong></summary>
<details><summary><strong>Gatsby</strong></summary>
<br />
**main.jsx**
**gatsby-browser.js** - Create the file at the root of your project if it doesn't exist, and relaunch the dev server.
```jsx
import '@smastrom/react-rating/style.css'
```
**in any component:**
**in any page/component:**
```jsx
```tsx
import { Rating } from '@smastrom/react-rating';

function App() {
const IndexPage = () => {
// ...
```
</details>
<details><summary><strong>Create React App</strong></summary>
<details><summary><strong>Vite</strong></summary>
<br />
**index.js**
**main.jsx**
```jsx
import '@smastrom/react-rating/style.css'
Expand Down
62 changes: 29 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@smastrom/react-rating",
"version": "1.3.1",
"version": "1.3.2",
"private": false,
"keywords": [
"react",
Expand Down Expand Up @@ -35,28 +35,24 @@
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js"
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./style.css": "./style.css",
"./style": "./style.css",
"./styles.css": "./style.css",
"./styles": "./style.css"
"./style.css": "./dist/style.css",
"./style": "./dist/style.css",
"./styles.css": "./dist/style.css",
"./styles": "./dist/style.css"
},
"main": "dist/index.js",
"module": "dist/index.mjs",
"browser": "dist/index.js",
"types": "dist/index.d.ts",
"style": "style.css",
"files": [
"dist",
"style.css"
"dist/*"
],
"scripts": {
"prebuild": "rimraf dist style.css src/exportedTypes.d.ts",
"build": "tsc && vite build && pnpm declare",
"postbuild": "cpy dist/style.css ./ --flat && cpy src/exportedTypes.d.ts dist --rename index.d.ts --flat && rimraf src/exportedTypes.d.ts dist/style.css",
"build": "rm -rf dist && tsc && vite build",
"postbuild": "./scripts/add-use-client.sh",
"coverage": "vitest run --coverage",
"declare": "tsc src/exportedTypes --declaration --emitDeclarationOnly",
"dev": "vite",
"test": "vitest",
"test:ct": "playwright test -c playwright-ct.config.ts",
Expand All @@ -71,36 +67,36 @@
"devDependencies": {
"@playwright/experimental-ct-react": "1.29.0",
"@playwright/test": "1.29.0",
"@rollup/plugin-terser": "^0.4.1",
"@testing-library/dom": "^9.2.0",
"@testing-library/jest-dom": "^5.16.5",
"@rollup/plugin-terser": "^0.4.3",
"@testing-library/dom": "^9.3.1",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
"@types/node": "^18.16.1",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.1",
"@types/testing-library__jest-dom": "^5.14.5",
"@typescript-eslint/eslint-plugin": "^5.59.1",
"@typescript-eslint/parser": "^5.59.1",
"@types/node": "^18.17.5",
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"@types/testing-library__jest-dom": "^5.14.9",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@vitejs/plugin-react": "^3.1.0",
"@vitest/coverage-c8": "^0.29.8",
"cpy-cli": "^4.2.0",
"eslint": "^8.39.0",
"eslint-plugin-react": "^7.32.2",
"eslint": "^8.47.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^8.0.3",
"jsdom": "^21.1.1",
"lint-staged": "^13.2.2",
"jsdom": "^21.1.2",
"lint-staged": "^13.3.0",
"prettier": "^2.8.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rimraf": "^4.4.1",
"typescript": "^5.0.4",
"vite": "^4.3.3",
"vitest": "^0.29.8"
"typescript": "^5.1.6",
"vite": "^4.4.9",
"vitest": "^0.29.8",
"vite-plugin-dts": "^3.5.2"
},
"peerDependencies": {
"react": ">=17",
"react-dom": ">=17"
"react": ">=18",
"react-dom": ">=18"
}
}
Loading

0 comments on commit 4afbd6a

Please sign in to comment.