-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from crashmax-dev/react-component
Added React component
- Loading branch information
Showing
30 changed files
with
1,202 additions
and
845 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { TWallpaper } from '@twallpaper/react' | ||
import '@twallpaper/react/css' | ||
|
||
export function App() { | ||
return <TWallpaper options={{ /* options */ }}/> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import { TWallpaper } from 'twallpaper' | ||
|
||
const container = document.querySelector('.tw-wrap') | ||
const wallpaper = new TWallpaper(container, { /* options */ }) | ||
const wallpaper = new TWallpaper(container, { | ||
/* options */ | ||
}) | ||
wallpaper.init() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
**/node_modules | ||
**/dist | ||
**/.turbo | ||
*.tgz | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
node_modules | ||
dist | ||
build | ||
logs | ||
.next | ||
.turbo | ||
.github | ||
.angular | ||
.svelte-kit | ||
*.log | ||
*.lock | ||
*.yaml | ||
*.yml | ||
*.sh | ||
*.svg | ||
*rc.* | ||
*.htm | ||
*.html | ||
*.json | ||
*.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('@crashmax/prettier-config') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
import { useEffect, useRef } from 'react' | ||
import { TWallpaper } from 'twallpaper' | ||
import 'twallpaper/css' | ||
import { useRef } from 'react' | ||
import { TWallpaper } from '@twallpaper/react' | ||
import type { TWallpaperHandlers } from '@twallpaper/react' | ||
import '@twallpaper/react/css' | ||
|
||
export function App() { | ||
const ref = useRef<HTMLDivElement>(null) | ||
const ref = useRef<TWallpaperHandlers>(null) | ||
|
||
useEffect(() => { | ||
const wallpaper = new TWallpaper(ref.current!) | ||
wallpaper.init({ colors: wallpaper.generateColors() }) | ||
|
||
return () => { | ||
wallpaper.dispose() | ||
} | ||
}, []) | ||
|
||
return <div ref={ref}></div> | ||
return ( | ||
<div> | ||
<div | ||
style={{ | ||
position: 'absolute', | ||
zIndex: 1, | ||
display: 'flex', | ||
gap: '1rem' | ||
}} | ||
> | ||
<button onClick={() => ref.current!.updateColors()}> | ||
Update colors | ||
</button> | ||
</div> | ||
<TWallpaper ref={ref} /> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<br> | ||
<p align="center"> | ||
<a href="https://twallpaper.js.org"> | ||
<img height="220" src="https://twallpaper.js.org/utya.webp"/> | ||
<br/> | ||
<h1 align="center">TWallpaper</h1> | ||
</a> | ||
</p> | ||
|
||
<p align="center"> | ||
<b>🌈 Multicolor gradient wallpaper created algorithmically and shimmers smoothly.</b> | ||
</p> | ||
|
||
<p align="center"> | ||
<a href="https://www.npmjs.com/package/@twallpaper/react"> | ||
<img alt="npm" src="https://img.shields.io/npm/v/twallpaper"> | ||
</a> | ||
<a href="https://www.npmjs.com/package/@twallpaper/react"> | ||
<img alt="npm" src="https://img.shields.io/npm/dt/@twallpaper/react?color=blue"> | ||
</a> | ||
<a href="https://bundlephobia.com/package/@twallpaper/react@latest"> | ||
<img alt="npm bundle size" src="https://img.shields.io/bundlephobia/minzip/@twallpaper/react"> | ||
</a> | ||
</p> | ||
|
||
## Installation | ||
|
||
```sh | ||
npm install @twallpaper/react | ||
``` | ||
|
||
```sh | ||
yarn add @twallpaper/react | ||
``` | ||
|
||
```sh | ||
pnpm add @twallpaper/react | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"name": "@twallpaper/react", | ||
"version": "1.1.0", | ||
"description": "🌈 Multicolor gradient wallpaper created algorithmically and shimmers smoothly.", | ||
"type": "module", | ||
"types": "./dist/index.d.ts", | ||
"module": "./dist/index.es.js", | ||
"main": "./dist/index.cjs.js", | ||
"main:umd": "./dist/index.umd.js", | ||
"files": [ | ||
"dist/index.cjs.js", | ||
"dist/index.es.js", | ||
"dist/index.umd.js", | ||
"dist/index.d.ts", | ||
"dist/style.css" | ||
], | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.es.js", | ||
"require": "./dist/index.cjs.js", | ||
"default": "./dist/index.es.js" | ||
}, | ||
"./dist/style.css": "./dist/style.css", | ||
"./css": "./dist/style.css" | ||
}, | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/crashmax-dev/twallpaper.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/crashmax-dev/twallpaper/issues" | ||
}, | ||
"homepage": "https://twallpaper.js.org", | ||
"keywords": [ | ||
"react", | ||
"multicolor", | ||
"gradient", | ||
"wallpaper", | ||
"background", | ||
"animation", | ||
"telegram", | ||
"canvas" | ||
], | ||
"scripts": { | ||
"dev": "vite build --watch", | ||
"build": "vite build", | ||
"prepublishOnly": "pnpm build" | ||
}, | ||
"dependencies": { | ||
"twallpaper": "workspace:1.3.0" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^18.0.15", | ||
"@vitejs/plugin-react": "^2.0.0", | ||
"react": "^18.2.0", | ||
"typescript": "^4.7.4", | ||
"vite": "^3.0.4" | ||
}, | ||
"peerDependencies": { | ||
"@types/react": ">=16.8.0", | ||
"react": ">=16.8.0" | ||
} | ||
} |
Oops, something went wrong.