1.0.6 • Published 4 years ago

react-igrid v1.0.6

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

react-igrid

Mimic the phone app in iphone, create a grid with spring-physics based animation.

For now, it only works on mobile device.

Installation

# npm install react-igrid

or

# yarn add react-igrid

Usage

Example

import React, { useRef } from 'react';
import Grid from 'react-igrid';
import { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock';

export default () => {
  const containerRef = useRef(null);

  return (
    <div ref={containerRef}>
      <Cube
        title="grid"
        excerpt="some excerpt"
        lockContainerScroll={lockContainerScroll}
        unlockContainerScroll={unlockContainerScroll}
      />
        <div>something in the children</div>
        <div>maybe a components</div>
      </Grid>
    </div>
  );
};

API Reference (WIP)

Props

namedefault valuedescription
initialWidthcalc(100vw / 3)initial width
initialHeightcalc(23.33vw - 0.666rem)initial height
initialColorrgba(255, 255, 255, 0.8)initial color
finalHeightcalc(100vh - 10%)final height
finalTop0final top position
finalLeft0final left position
finalRight0final right position
finalColorlightbluefinal color
titletesttitle
excerpt1234excerpt
imageimage
childrenReact components

Events

namedefault valuedescription
lockContainerScroll() => {}lock the parent container scroll
unlockContainerScroll() => {}unlock the parent container scroll

Contribute

Contributions, issues and feature requests are welcome.

Credits

Inspired by Progressive Web Animations | Alexandra Holachek at React Conf 2019.

Here is the youtube

1.0.6

4 years ago

1.0.5

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago