Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
react-md-spinner
Advanced tools
Material Design spinner components for React.js.
Live example: https://tsuyoshiwada.github.io/react-md-spinner/
You can install the react-md-spinner from npm.
$ npm i -S react-md-spinner
# or
$ yarn add react-md-spinner
Because it is made of 100% inline styles, you can start using it right away without setting.
import React from "react";
import MDSpinner from "react-md-spinner";
export const SpinnerExample: React.FC = () => (
<div>
<MDSpinner />
</div>
);
The following is an example of Server-Side Rendering.
Please checkout examples directory for details.
The point is to use ssrBehavior
.
Note: The following is pseudo code.
Client-Side:
import React from "react";
import { render } from "react-dom";
import App from "./App";
render(<App />, document.getElementById("app"));
Server-Side:
import { ssrBehavior } from "react-md-spinner";
// ...
const html = (root: JSX.Element) => `<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
${ssrBehavior.getStylesheetString()}
</head>
<body>
<div id="app">${renderToString(root)}</div>
<script defer src="/client.js"></script>
</body>
</html>`;
app.get("/", (_req, res) => {
res.status(200).send(`<!doctype html>${renderer(<App />)}`);
});
App:
import React from "react";
import MDSpinner from "react-md-spinner";
export const App: React.FC = () => (
<div>
<MDSpinner />
</div>
);
You can use the following Props. All Props are Optional!
size
type: number
default: 28
Set the size (diameter) of the spinner circle.
borderSize
type: number
default: undefined
Set the spinner border size of. By default, the appropriate size is calculated according to the value of size
.
duration
type: number
default: 1333
Set the animation duration (ms) of the spinner.
color1
type: string
default: !rgb(66, 165, 245)
The color of the spinner. Can be set to any valid CSS string (hex, rgb, rgba).
color2
type: string
default: rgb(239, 83, 80)
Same as above.
color3
type: string
default: rgb(253, 216, 53)
Same as above.
color4
type: string
default: rgb(76, 175, 80)
Same as above.
singleColor
type: string
default: undefined
Same as above. Use this if the spinner should be in only one single color. The settings (props) for color1
~ 4
will be ignored by setting this singleColor
property.
ssrBehavior
In Server-Side Rendering you need to inject @keyframes
inside the <head>
.
react-md-spinner
provides utilities to handle them.
ssrBehavior.getStylesheetString(): string
ssrBehavior.getStylesheetComponent(): React.ReactNode
import { ssrBehavior } from "react-md-spinner";
const html = () => `<!doctype html>
<head>
${ssrBehavior.getStylesheetString()}
</head>
<body>
<div id="app">
// React stuff here
</div>
</body>
</html>`;
import React from "react";
import { ssrBehavior } from "react-md-spinner";
const Html: React.FC = () => (
<html>
<head>{ssrBehavior.getStylesheetComponent()}</head>
<body>
<div id="app">{/* React stuff here */}</div>
</body>
</html>
);
See CHANGELOG.md
We are always welcoming your contribution :clap:
$ yarn test
command and confirm that it passes :zap:master
branch :bulb:yarn test
Run unit test using Jest.
yarn lint
Run Lint of source code using ESLint.
yarn format
Run formatting using Prettier and ESLint's Fixer.
yarn build
Run build of TypeScript code.
yarn storybook
Run Storybook.
FAQs
Material Design Spinner components for React.js.
The npm package react-md-spinner receives a total of 9,845 weekly downloads. As such, react-md-spinner popularity was classified as popular.
We found that react-md-spinner 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.