generated from fers4t/react-package-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:
buttonClassNames
and buttonStyles
- Loading branch information
Showing
2 changed files
with
69 additions
and
9 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 |
---|---|---|
@@ -1,9 +1,64 @@ | ||
### IN DEVELOPMENT | ||
# cloudinary-react-widget | ||
|
||
## Install package to Next.js app | ||
Next.js component for [Cloudinary Upload Widget](https://cloudinary.com/documentation/upload_widget) | ||
|
||
cd example pnpm install ../ | ||
### Installing | ||
|
||
## Watch changes | ||
I did not release it on NPM for now. So you can install it like this; | ||
|
||
cd to root folder and run pnpm watch | ||
```bash | ||
pnpm install fers4t/cloudinary-react-widget | ||
``` | ||
|
||
### Usage | ||
|
||
```tsx | ||
import React, { useState } from 'react'; | ||
import { CloudinaryUpload } from 'cloudinary-react-widget'; | ||
|
||
export default function Home() { | ||
const [callbacks, setCallbacks] = useState(); | ||
return ( | ||
<CloudinaryUpload | ||
cloudName="YOUR CLOUD NAME" | ||
uploadPreset="YOUR UPLOAD PRESET" | ||
onUpload={(a) => setCallbacks(a)} | ||
/> | ||
); | ||
} | ||
``` | ||
|
||
You can track all callbacks with `onUpload` prop. I'm storing all of them. | ||
|
||
## Styling | ||
|
||
```tsx | ||
import React, { useState } from 'react'; | ||
import { CloudinaryUpload } from 'cloudinary-react-widget'; | ||
|
||
export default function Home() { | ||
const [callbacks, setCallbacks] = useState(); | ||
|
||
return ( | ||
<CloudinaryUpload | ||
cloudName="YOUR CLOUD NAME" | ||
uploadPreset="YOUR UPLOAD PRESET" | ||
onUpload={(a) => setCallbacks(a)} | ||
buttonClassNames="text-lg font-bold" | ||
imageWrapperStyles={{ width: '100px', height: '100px' }} | ||
/> | ||
); | ||
} | ||
``` | ||
|
||
Custom styles are **overriding defaults completely**. So if you want to use custom styles, you must handle whole style yourself. | ||
|
||
## TO-DO | ||
|
||
- [ ] Add `multiple` prop to prevent/allow multiple uploads. | ||
- [ ] Add `signed` version | ||
... open issues/PRs for more. | ||
|
||
## License | ||
|
||
This project is licensed under the MIT License. |
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