Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
react-use-presentation
Advanced tools
Create pure HTML (React enriched if you will) presentations with a provided array of components and their time durations. The library will do the rest triggering a re-render per array item.
Statements | Branches | Functions | Lines |
---|---|---|---|
Plain | Video BG |
---|---|
Preview! | Preview with BG video! |
You may also find a running example in this project which are served at Github Pages.
npm install --save react-use-presentation
export const myFramesArray = [
{
component: <div>First Frame with 1 second duration</div>,
time: 1000
},
{
component: <div>Second Frame with 2 second duration</div>,
time: 2000
},
{
component: <div>Last Frame without duration</div>,
},
...
]
import * as react from 'react';
import usePresentation from 'react-use-presentation';
import { myFramesArray1 } from './myFramesArray';
export default function App() {
const [Presentation] = usePresentation({
framesOptions: myFramesArray1,
startTrigger: false,
});
return <Presentation />;
}
import * as react from 'react';
import usePresentation from 'react-use-presentation';
import { myFramesArray2 } from './myFramesArray';
export default function App() {
const [DelayedPresentation] = usePresentation({
framesOptions: myFramesArray2,
startTrigger: true,
startDelay: 1000,
});
return <DelayedPresentation />;
}
import * as react from 'react';
import usePresentation from 'react-use-presentation';
import { myFramesArray3 } from './myFramesArray';
export default function App() {
const [DelayedAndLoopedPresentation] = usePresentation({
framesOptions: myFramesArray3,
startTrigger: true,
startDelay: 1000,
isLoop: true,
});
return <DelayedAndLoopedPresentation />;
}
import * as react from 'react';
import usePresentation from 'react-use-presentation';
import {
myFramesArray1,
myFramesArray2,
myFramesArray3,
} from './myFramesArray';
export default function App() {
const [Presentation] = usePresentation({
framesOptions: myFramesArray1,
startTrigger: false,
});
const [DelayedPresentation] = usePresentation({
framesOptions: myFramesArray2,
startTrigger: true,
startDelay: 1000,
});
const [
DelayedAndLoopedPresentation,
currentLoopFrame,
loopFramesLength,
] = usePresentation({
framesOptions: myFramesArray3,
startTrigger: true,
startDelay: 1000,
isLoop: true,
});
return (
<>
<Presentation />
<DelayedPresentation />
<div>
<p>
Current frame: {currentLoopFrame}/{loopFramesLength}
</p>
<DelayedAndLoopedPresentation />
</div>
</>
);
}
import * as react from 'react';
import usePresentation from 'react-use-presentation';
import { myFramesArray1 } from './myFramesArray';
export default function App() {
const [
PresentationWithChildren,
currentFrame,
framesLength,
] = usePresentation({
framesOptions: myFramesArray1,
startTrigger: true,
});
return (
<PresentationWithChildren>
<p>
Current frame: {currentFrame}/{framesLength}
</p>
</PresentationWithChildren>
);
}
startTrigger
as a control. You can also specify a callback to when it finishes:import * as react from 'react';
import usePresentation from 'react-use-presentation';
import { myFramesArray1 } from './myFramesArray';
export default function App() {
const [startTrigger, setStartTrigger] = React.useState(false);
const [PresentationTriggered] = usePresentation({
framesOptions: myFramesArray1,
startTrigger,
callback: () => setStartTrigger(false),
});
return (
<>
<button type="button" onClick={() => setStartTrigger(true)}>
Click to start presenting!
</button>
<PresentationTriggered />
</>
);
}
usePresentation()
constructor:
type TFrameOptions = {
component: Component | null;
time?: number;
};
type TUsePresentation = {
framesOptions: TFrameOptions[];
startTrigger: boolean;
startDelay?: number;
isLoop?: boolean;
};
usePresentation(TUsePresentation);
usePresentation()
returns:
An array with 3 positions, described below:
As the return is an array you may name each array position in an arbitrary way, e.g.:
const [
MyLittleComponent,
currentFrameLittle,
totalLengthLittle,
] = usePresentation();
CSS selectors
:
className="animation-frame"
className="animation-frame with-children"
const [PresentationCustomCss] = usePresentation({
framesOptions: myFramesArray1,
startTrigger: true,
});
return <PresentationCustomCss className="my-custom-class" />;
Thanks goes to these wonderful people (emoji key):
Olavo Parno 🤔 💻 ⚠️ |
This project follows the all-contributors specification. Contributions of any kind welcome!
react-use-presentation is MIT licensed.
This hook is created using create-react-hook.
FAQs
Create pure HTML (React enriched if you will) presentations.
We found that react-use-presentation demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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 researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.