Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-kofi-overlay
Advanced tools
React component for accepting donations though Ko-fi without leaving your website
A React component for accepting donations though Ko-fi without leaving your website:
To set up what Ko-fi calls their "Floating Button Donation Widget," they let you do some basic customization and ask you to copy and paste two <script>
tags onto your site:
This has some limitations:
<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:
kofiWidgetOverlay.draw(...)
– and to only run that code after the external overlay-widget.js
script is loaded.This component is designed to address those limitations.
npm install react-kofi-overlay
(or equivalent on your package manager)
import { Donate } from 'react-kofi-overlay'
<Donate
username="liddiard"
classNames={{
donateBtn: 'myDonateButton',
profileLink: 'myProfileLink'
}}
styles={{
panel: { marginRight: '4em' }
}}
onToggle={(open) => {
console.log(`Donate panel ${open ? 'opened' : 'closed'}`)
}}
>
❤️ Support Me
</Donate>
Prop | Required | Type | Description |
---|---|---|---|
(children) | required | ReactNode | Contents of the donation button. Can be plain text or any React nodes that are valid children of a <button> element. |
username | required | string | Ko-fi profile to display in the donation panel. Corresponds to the page at ko-fi.com/<username> . |
classNames | optional | object | Class names to apply to different parts of the component for styling. See Styling for more info. |
styles | optional | object | Inline styles to apply to different parts of the component for styling. See Styling for more info. |
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. |
The component accepts classNames
or styles
props to customize the appearance of the donate button and various parts of the donate panel. Both props should be an object with one or more of the keys below.
Note: While you could provide both classNames
and styles
, it isn't recommended because they will override one another. Pick one based on how you're writing CSS in your codebase.
Name | Description |
---|---|
donateBtn | Donate <button> element. |
panel | Wrapper <div> around panel that appears when donate button is clicked. By default, the panel is anchored to the bottom right of the viewport on desktop and full screen on mobile. |
closeBtn | <button> to close the donate panel. |
closeIcon | (X) icon within the panel close button. |
profileLink | Wrapper <div> around the link to your Ko-fi profile. By default, it's anchored to the bottom of the donate panel. |
For local development of this plugin:
npm install
To build: npm run build
This project is not endorsed by or affiliated with Ko-fi Labs, the company behind Ko-fi.
FAQs
React component for accepting donations though Ko-fi without leaving your website
The npm package react-kofi-overlay receives a total of 1 weekly downloads. As such, react-kofi-overlay popularity was classified as not popular.
We found that react-kofi-overlay demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.