Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
react-magnetic-board
Advanced tools
Light, zero dependencies magnetic board component using HTML5 canvas 🧲
Demos created with React DemoTab 📑
npm install react-magnetic-board
import React from 'react';
import ReactDOM from 'react-dom';
import MagneticBoard from 'react-magnetic-board';
const circleSVG = 'M 100, 100 m -75, 0 a 75,75 0 1,0 150,0 a 75,75 0 1,0 -150,0';
const App = () => {
return (
<MagneticBoard
magnet={{
path: circleSVG,
scale: 0.25,
offsetX: 100,
offsetY: 90,
fillStyle: '#d93030',
shadowColor: '#bf2626',
shadowBlur: 5,
}}
width={600}
height={500}
/>
);
};
ReactDOM.render(<App />, document.getElementById('root'));
All of the props are optional.
Below is the complete list of possible props and their options:
▶︎ indicates the default value if there's one
magnet: Magnet ▶︎ undefined
Magnet = {
path: string;
scale?: number;
offsetX?: number;
offsetY?: number;
fillStyle?: string;
shadowColor?: string;
shadowBlur?: number;
x?: number;
y?: number;
}
Magnet resource.
width: number ▶︎ 500
Magnetic Board width.
height: number ▶︎ 400
Magnetic Board height.
className: string ▶︎ undefined
Class name.
initMagnets: Magnet[] ▶︎ []
Initialize magnets.
onUndo: boolean ▶︎ undefined
Inverting 'onUndo' prop value triggers undo command.
onClear: boolean ▶︎ undefined
Inverting 'onClear' prop value clears the board.
onMagnetChange: Function => (magnets: Magnet[])
Gets triggered when user changes magnet(s) on the component.
Easily set up a local development environment!
Build all the examples and starts storybook server on localhost:9009:
npm install
npm start
OR
Clone this repo on your machine, navigate to its location in the terminal and run:
npm install
npm link # link your local repo to your global packages
npm run build:watch # build the files and watch for changes
Clone project repo that you wish to test with react-magnetic-board library and run:
npm install
npm link react-magnetic-board # link your local copy into this project's node_modules
npm start
Start coding! 🎉
FAQs
React magnetic board component using HTML5 canvas.
The npm package react-magnetic-board receives a total of 4 weekly downloads. As such, react-magnetic-board popularity was classified as not popular.
We found that react-magnetic-board demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.