react-kofi-overlay 0.2.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -11
- package/img/example.gif +0 -0
- package/img/styling_reference.png +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[**Jump to usage**](#usage)
|
|
4
4
|
|
|
5
|
-
React component for accepting donations though Ko-fi without leaving your website:
|
|
6
|
-
|
|
5
|
+
A React component for accepting donations though Ko-fi without leaving your website:
|
|
7
6
|
|
|
7
|
+

|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
@@ -21,17 +21,17 @@ To set up what Ko-fi calls their "[Floating Button Donation Widget](https://ko-f
|
|
|
21
21
|
|
|
22
22
|
This has some limitations:
|
|
23
23
|
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
- Requires an extra network request on every page load
|
|
28
|
-
- Doesn't work well with modern JS bundling + import/export
|
|
29
|
-
- Doesn't work well with a React component-based frontend
|
|
24
|
+
- Only a few choices for button CTA (call-to-action text)
|
|
25
|
+
- Limited selection of background color choices
|
|
26
|
+
- Requires you to load a `<script>` tag from their CDN, which creates a global variable, and you then need to call a method on that global to render the donate button. Few potential issues with that:
|
|
27
|
+
- Requires an extra network request on every page load
|
|
28
|
+
- Doesn't work well with modern JS bundling + import/export syntax
|
|
29
|
+
- Doesn't work well with a React component-based frontend
|
|
30
30
|
- Doesn't play nice with web frameworks like Next.js. Next.js makes it difficult to inject an arbitrary script like `kofiWidgetOverlay.draw(...)` – and to only run that code after the external `overlay-widget.js` script is loaded.
|
|
31
31
|
|
|
32
32
|
This component is designed to address those limitations.
|
|
33
33
|
|
|
34
|
-
##
|
|
34
|
+
## Install
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
37
|
npm install react-kofi-overlay
|
|
@@ -63,12 +63,14 @@ import { Donate } from 'react-kofi-overlay'
|
|
|
63
63
|
</Donate>
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
+
**[Full example on CodePen](https://codepen.io/liddiard/pen/eYXNVXy)**
|
|
67
|
+
|
|
66
68
|
### Props
|
|
67
69
|
|
|
68
70
|
| Prop | Required | Type | Description |
|
|
69
71
|
| ------------- | ------------- | ------------- | ------------- |
|
|
70
72
|
| (children) | required | ReactNode | Contents of the donation button. Can be plain text or any React nodes that are valid children of a `<button>` element. |
|
|
71
|
-
| `username` | required | string | Ko-fi profile to display in the donation panel. Corresponds to the
|
|
73
|
+
| `username` | required | string | Ko-fi profile to display in the donation panel. Corresponds to the page at `ko-fi.com/<username>` |
|
|
72
74
|
| `classNames` | optional | object | Class names to apply to different parts of the component for styling. See [Styling](#styling) for more info. |
|
|
73
75
|
| `styles` | optional | object | Inline styles to apply to different parts of the component for styling. See [Styling](#styling) for more info. |
|
|
74
76
|
| `onToggle` | optional | function | Function to call when the donate panel is opened or closed. It receives one argument: a boolean `open` value that indicates if the panel was opened or closed. |
|
|
@@ -87,5 +89,16 @@ Note: While you could provide both `classNames` and `styles`, it isn't recommend
|
|
|
87
89
|
| `closeIcon` | (X) icon within the panel close button. |
|
|
88
90
|
| `profileLink` | Wrapper `<div>` around the link to your Ko-fi profile. By default, it's anchored to the bottom of the donate panel. |
|
|
89
91
|
|
|
92
|
+
#### Visual reference
|
|
93
|
+
|
|
94
|
+

|
|
95
|
+
|
|
96
|
+
## Development
|
|
97
|
+
|
|
98
|
+
For local development of this plugin:
|
|
99
|
+
|
|
100
|
+
1. Clone the repository
|
|
101
|
+
2. `npm install`
|
|
102
|
+
|
|
103
|
+
To build: `npm run build`
|
|
90
104
|
|
|
91
|
-
## Development
|
package/img/example.gif
ADDED
|
Binary file
|
|
Binary file
|