
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
react-fullpage-custom-loader
Advanced tools
A full page loading modal with spinners and random custom text for React
A full page loading modal with spinners and random custom text for React
npm install --save react-fullpage-custom-loader
For a small React templating example: cd
to react-fullpage-custom-loader/example and npm start
or check it out on its Github page
import React, { Component } from 'react'
import MyComponent from 'react-fullpage-custom-loader'
class Example extends Component {
render () {
return (
<MyComponent />
)
}
}
import React, { Component } from 'react'
import MyComponent from 'react-fullpage-custom-loader'
class Example extends Component {
render () {
return (
<MyComponent customLoader={<CustomSpinnerComponent />}/>
)
}
}
These are all the props you could pass to the component MyComponent
const props: {
sentences: PropTypes.array,
loaderType: PropTypes.string,
loaderSize: PropTypes.string,
color: PropTypes.string,
textStyles: PropTypes.object,
wrapperBackgroundColor: PropTypes.string,
counter: PropTypes.bool,
counterMax: PropTypes.number,
counterDelay: PropTypes.number,
counterChars: PropTypes.string,
counterStyles: PropTypes.object,
fadeIn: PropTypes.bool,
startFadeOut: PropTypes.bool,
customLoader: PropTypes.object,
width: PropTypes.string,
height: PropTypes.string,
}
prop | type | default | description | example |
---|---|---|---|---|
sentences | Array of strings | Random quotes form authors I like (Adams, Pratchett, Asimov, Clarke) | You can set as many sentences you like and thanks to CSS display: preline you could insert line breaks with \n | ['One sentence', 'One with a \n linebreak', '"Quoting an " - author'] |
loaderType | string / enum | ball-spin-clockwise | A string representing one of the 52 possible animations (see list below) | timer |
loaderSize | string | null | There are 3 possible sizes: small , big and null for normal | big |
color | string | white | Any valid CSS color string | rgba(0, 0, 0, 0.75) |
textStyles | object | { ...css.stuff } | Use it to override the main text properties. Accepts any React CSS style object | { color: 'red', fontSize: '3em' } |
wrapperBackgroundColor | string | rgba(0,0,0,0.75) | Any valid CSS for property background will work, even gradients and RGBA | black |
counter | boolean | false | You can show a counter that is either a number representing the cycles or a series of characters | true |
counterMax | integer | 15 | The maximum number of cycles to stop randomizing sentences | 15 |
counterDelay | integer | 3000 | The number of milliseconds before a new cycle will throw a random to show a new sentence | 1000 |
counterChars | string | . | A series of characters to be shown in the counter zone adding one every cycle | 😅 |
counterStyles | object | {...this.props.textStyles} | Use it to override the counter text properties. Accepts any React CSS style object and default to the above textStyles | { color: 'red', fontSize: '3em' } |
fadeIn | boolean | false | If set to true , the loader is shown with a fade in effect on opacity (300ms ease-out) | true |
startFadeOut | boolean | false | When this is set to true the entire loader will start to fade out on opacity (300ms ease-in), but even if faded you must destroy the component yourself | true |
customLoader | Object / React component | null | You could pass a component to be shown INSTEAD of one the loaders | customLoader={<CustomLoader />} |
width | string | null | a custom width for the background | '500px' or '100%' |
height | string | null | a custom height for the background | '500px' or '100%' |
When you choose a Spinner we lazy-load only that component (a functional React component importing a small css file) and we pass your styles to it. You could use this components stand alone, you will only need the right CSS file and the right amount of <DIV />
elements to include (I know, a bit confusing, make sense if you look at the original spinners demo HTML)
For performance issues you should create and destroy this component (for instance at render()
time) such as:
render () {
return (
{this.state.showLoader && <MyComponent {...options} />}
)
}
In React terms this means that you take the element away from the DOM and you won't have time to start our nice fade out animation. If you want to fade out your component you will need a bit of a workaround, something on the lines of:
fadeAndCloseLoader = () => {
this.setState({startFadeOut: true}))
setTimeout(() => {
this.setState({showLoader: false, startFadeOut: false})
}, 300)
}
render () {
return (
{this.state.showLoader && <MyComponent
{...options}
startFadeOut={this.state.startFadeOut}/>
}
)
}
In this example the method fadeAndCloseLoader()
sends the startFadeOut prop first, the 300 milliseconds later destroys the Component. Note that in the same timeout call we reset startFadeOut to false to hide the CSS .hidden
class in case you wanted to reopen the loader.
All animations are 100% CSS.
A demo of all (100% CSS) spinners can be found at Load Awesome, just note that I couldn't make Cog
to work and it is therefore not included.
Here is a useful copy/paste list (note the typo fussion
has been kept for too many reasons I do not have the time to explain here, my most sincere apologies):
This doesn't work, don't use it. You have been warned.
MIT © regrunge
All Loaders CSS files are coming from load-awesome MIT © danielcardoso (I have used 52 of his 53 awesome loaders, missing only Cog that didn't display as it should)
FAQs
A full page loading modal with spinners and random custom text for React
The npm package react-fullpage-custom-loader receives a total of 69 weekly downloads. As such, react-fullpage-custom-loader popularity was classified as not popular.
We found that react-fullpage-custom-loader 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.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.