1.0.2 • Published 5 years ago

overlay-reveal-effect v1.0.2

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

Overlay reveal effect react-component.



Props

NameTypeDefaultDescription
childrennodeThe content node to be showed.
directionstringtop-rightDirection the child node will enter from.
isOpenbooleanfalseIf true, the component will transition in.
mainFonstring#90caf9The main background color.
secondaryFonstring#ec407aThe secondary background color of overlay.


Example

DEMO

import React, {useState} from 'react';
import OverlayEffect from 'overlay-reveal-effect';

class App extends React.Component {
  render() {
    const [open, setOpen] = useState(false);
    
    const handleOpen = () => {
      setOpen(true);
    };
    
    const handleClose = () => {
      setOpen(false);
    }

    return (
      <div>
        <button onClick={handleOpen}>OPEN</button>
        
        <OverlayEffect isOpen={open}>
          <h1>Overlay Effect</h1>
          <button onClick={handleClose}>CLOSE</button>
        </OverlayEffect>
      </div>
    )
  }
}