Skip to content

Commit 683ff7e

Browse files
committed
1.0.0 & Update react peer dependency & Update README
1 parent d8ad7e0 commit 683ff7e

File tree

6 files changed

+48
-40
lines changed

6 files changed

+48
-40
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ This React library is a wrapper around [PowerGlitch](https://github.com/7PH/powe
3535
In order to glitch something, call `useGlitch()` and store its result in a variable.
3636
```jsx
3737
function App() {
38-
const glitched = useGlitch();
38+
const glitch = useGlitch();
3939
4040
return (
41-
<h1>react-powerglitch <span ref={glitched.ref}>🌎</span></h1>
41+
<h1>react-powerglitch <span ref={glitch.ref}>🌎</span></h1>
4242
);
4343
}
4444
```
@@ -48,7 +48,7 @@ One limitation due to React internals is to never place a glitched element as th
4848
<>
4949
{/* Do NOT do this */}
5050
{condition &&
51-
<span ref={glitched.ref}>🌎</span>
51+
<span ref={glitch.ref}>🌎</span>
5252
}
5353
</>
5454
```
@@ -58,7 +58,7 @@ Instead, wrap the glitched element with a container:
5858
<>
5959
{condition &&
6060
<div>
61-
<span ref={glitched.ref}>🌎</span>
61+
<span ref={glitch.ref}>🌎</span>
6262
</div>
6363
}
6464
</>
@@ -69,10 +69,10 @@ Instead, wrap the glitched element with a container:
6969
You can pass options to customize the glitch effect to `useGlitch`:
7070
```jsx
7171
function App() {
72-
const glitched = useGlitch({ glitchTimeSpan: false });
72+
const glitch = useGlitch({ glitchTimeSpan: false });
7373
7474
return (
75-
<h1>react-powerglitch <span ref={glitched.ref}>🌎</span></h1>
75+
<h1>react-powerglitch <span ref={glitch.ref}>🌎</span></h1>
7676
);
7777
}
7878
```
@@ -91,17 +91,17 @@ The `useGlitch` hook returns an object containing:
9191
Here is an example:
9292
```jsx
9393
function App() {
94-
const glitched = useGlitch({ glitchTimeSpan: false });
94+
const glitch = useGlitch({ glitchTimeSpan: false });
9595
9696
return (
9797
<>
9898
<div>
99-
<h1 ref={glitched.ref}>react-powerglitch 🌎</h1>
99+
<h1 ref={glitch.ref}>react-powerglitch 🌎</h1>
100100
</div>
101-
<button onClick={glitched.startGlitch}>
101+
<button onClick={glitch.startGlitch}>
102102
Start
103103
</button>
104-
<button onClick={glitched.stopGlitch}>
104+
<button onClick={glitch.stopGlitch}>
105105
Stop
106106
</button>
107107
</>
@@ -119,17 +119,17 @@ Your IDE should automatically identify the return type of `useGlitch` to be `Gli
119119
import { useGlitch, GlitchHandle } from 'react-powerglitch';
120120
121121
function App() {
122-
const glitched: GlitchHandle = useGlitch({ glitchTimeSpan: false });
122+
const glitch: GlitchHandle = useGlitch({ glitchTimeSpan: false });
123123
124124
return (
125125
<>
126126
<div>
127-
<h1 ref={glitched.ref}>react-powerglitch 🌎</h1>
127+
<h1 ref={glitch.ref}>react-powerglitch 🌎</h1>
128128
</div>
129-
<button onClick={glitched.startGlitch}>
129+
<button onClick={glitch.startGlitch}>
130130
Start
131131
</button>
132-
<button onClick={glitched.stopGlitch}>
132+
<button onClick={glitch.stopGlitch}>
133133
Stop
134134
</button>
135135
</>

package-lock.json

Lines changed: 18 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-powerglitch",
3-
"version": "0.0.1",
3+
"version": "1.0.0",
44
"types": "./types/lib/index.d.ts",
55
"main": "./lib/react-powerglitch.umd.js",
66
"module": "./lib/react-powerglitch.es.js",
@@ -23,8 +23,8 @@
2323
"powerglitch": "^2.2.0"
2424
},
2525
"peerDependencies": {
26-
"react": "^18.2.0",
27-
"react-dom": "^18.2.0"
26+
"react": ">= 16.8.0",
27+
"react-dom": ">= 16.8.0"
2828
},
2929
"devDependencies": {
3030
"@types/react": "^18.0.17",
@@ -34,6 +34,8 @@
3434
"@vitejs/plugin-react": "^2.1.0",
3535
"eslint": "^8.23.1",
3636
"eslint-plugin-react": "^7.31.8",
37+
"react": "^18.2.0",
38+
"react-dom": "^18.2.0",
3739
"typescript": "^4.6.4",
3840
"vite": "^3.1.0"
3941
}

src/docs/App.css

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/docs/App.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
import React, { useState } from 'react';
22
import { GlitchHandle, useGlitch } from '../lib/';
3-
import './App.css';
43

54

65
function App() {
7-
const glitched: GlitchHandle = useGlitch({ hideOverflow: true, glitchTimeSpan: { start: 0, end: 1 } });
6+
const glitch: GlitchHandle = useGlitch({ hideOverflow: true, glitchTimeSpan: { start: 0, end: 1 } });
87
const [show, setShow] = useState(true);
98

109
return (
1110
<>
1211
{show &&
1312
<div>
14-
<h1 ref={glitched.ref}>react-powerglitch 🌎</h1>
13+
<h1 ref={glitch.ref}>react-powerglitch 🌎</h1>
1514
</div>
1615
}
17-
<button onClick={glitched.startGlitch}>
16+
<button onClick={glitch.startGlitch}>
1817
Start
1918
</button>
20-
<button onClick={glitched.stopGlitch}>
19+
<button onClick={glitch.stopGlitch}>
2120
Stop
2221
</button>
2322
<button onClick={() => setShow(! show)}>

src/docs/index.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
-webkit-text-size-adjust: 100%;
1616
}
1717

18+
#root {
19+
max-width: 1280px;
20+
margin: 0 auto;
21+
padding: 2rem;
22+
text-align: center;
23+
}
24+
1825
body {
1926
margin: 0;
2027
display: flex;

0 commit comments

Comments
 (0)