• Stars
    star
    747
  • Rank 60,741 (Top 2 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A set of React components for animating elements as they scroll into the viewport

🧞‍♂️ react-genie

🙋‍♂️ Made by @thekitze

Other projects:

  • 💻 Sizzy - A browser for designers and developers, focused on responsive design
  • 🏫 React Academy - Interactive React and GraphQL workshops
  • 🔮 Glink - Changelogs, Roadmap, User Requests
  • 🐶 Benji - Ultimate wellness and productivity platform
  • 🤖 JSUI - A powerful UI toolkit for managing JavaScript apps
  • 📹 YouTube Vlog - Follow my journey

Zero To Shipped

Used on sizzy.co

animation

CodeSandbox

https://codesandbox.io/s/react-genie-example-8xfsc

Demo

https://8xfsc.csb.app/

Dependencies

  • styled-components
  • layout-styled-components
  • react-animations
  • react-intersection-observer

Usage

yarn add react-genie

Just render the RevealGlobalStyles component anywhere, so it will add the class names for the animations:

import {RevealGlobalStyles} from 'react-genie'

const App = () => {
  return (
    <div>
      <RevealGlobalStyles />
      <div> rest of the app </div>
    </div>
  );
};

Default animation:

import {Reveal} from 'react-genie';

<Reveal>
  <h1>The default animation is fade in</h1>
</Reveal>

Props:

{
  animation?: string; // animation class name
  delay?: number; // animation delay
  mode?: RevealMode; // "clone" or "wrap"
  debugName?: string; // if you specify it, you will get console logs
  style?: CSSObject; // extra styles
  onShowDone?: () => void; // callback after show
}

Specifying animation using the animation prop:

import {Reveal, Animation} from 'react-genie';

<Reveal animation={Animation.SlideInLeft}>
  <h1>This title will slide in from the left</h1>
</Reveal>

Hint: you can also pass your own class name here if you have custom animations.

Wrap vs Clone

The default mode is wrap, so the children element will be wrapped in an additional div. If you don't want that additional div, you can use clone or RevealMode.Clone.

import {Reveal, RevealMode} from 'react-genie';

<Reveal mode={RevealMode.Clone}>
  <h1>This h1 will be cloned instead of wrapped</h1>
</Reveal>

In order for clone to work your element needs to accept className, style, and ref, as props. So, if you're trying to clone custom components, make sure they support these props.

The AnimatedTitle component

import {Reveal, AnimatedTitle} from 'react-genie';

<AnimatedTitle>
  This sentence will animate in word by word
</AnimatedTitle>

The AnimatedTitle component will split the children prop word by word (so it should be a string), and animate each word with a delay in between.

More Repositories

1

JSUI

A powerful UI toolkit for managing JavaScript apps
JavaScript
4,244
star
2

react-hanger

A collection of useful React hooks
TypeScript
1,935
star
3

awesome-conference-practices

Did you like anything in particular about a conference? Let's make an awesome list 🎉
1,050
star
4

twizzle-landing

The landing page for Twizzle
JavaScript
644
star
5

mobx-router

A simple router for MobX + React apps
TypeScript
509
star
6

react-electron-example

An example of using React (create-react-app) with Electron
JavaScript
349
star
7

twizzle

A desktop app for Twitter DM & composing tweets from the menubar. Works on macOS, Windows, and Linux.
JavaScript
275
star
8

styles-debugger

A helper for visually debugging styles in CSS-in-JS
JavaScript
130
star
9

copy-lite

Copy to clipboard function with no dependencies
TypeScript
119
star
10

react-tiniest-router

The tiniest router for React, built with hooks
TypeScript
105
star
11

graphql-user

Reusable utility methods for GraphQL authentication in Node.js
TypeScript
104
star
12

react-long

A LongPress component for React
JavaScript
88
star
13

voice-command-list

Temporary repository for the voice-command-list project.
88
star
14

react-disable

A React component for disabling a section of an app
TypeScript
77
star
15

react-in-markdown

Render custom React components in Markdown
JavaScript
67
star
16

gtb

Gulp The Builder
JavaScript
40
star
17

twiwdev

This Week In Webdev
27
star
18

tired-of-webdev

26
star
19

kitze-js-helpers

JS helper functions
JavaScript
25
star
20

phone-browser

Source code for why-iphone-x
JavaScript
22
star
21

mobx-router-example

MobX router example
JavaScript
20
star
22

rttr

A tiny router for mobx-state-tree apps
JavaScript
13
star
23

shortcuts-to-icloud

Watch a folder with js shortcuts for Siri and transfer them to iCloud on every change
JavaScript
13
star
24

extension-twitter-no-views

Hides the annoying view count on Twitter with CSS
Shell
12
star
25

payment-gateway-calculator

A calculator for comparing fees and profit between different payment processor gateways
JavaScript
11
star
26

react-genie-emotion

Animations for using react-genie with emotion
TypeScript
9
star
27

styled-mixins

A collection of css-in-js mixins
TypeScript
9
star
28

apollo-react-user

Opinionated package for adding authentication to a React + Apollo app
TypeScript
8
star
29

kitze-sass-helpers

Helpful sass mixins for generating BEM syntax and making SASS development easier
CSS
6
star
30

react-plop

React templates for plop
JavaScript
6
star
31

prisma2-template

TypeScript
5
star
32

snakepong-gpt-4

snakepong game made by GPT-4
JavaScript
5
star
33

react-academy-labs-starter-2

JavaScript
4
star
34

mantine-layout-components

Horizontal, Vertical, and Grid components for Mantine
TypeScript
3
star
35

fakeGPT

generate fake screenshots of conversations with chatGPT
TypeScript
3
star
36

mobx-router-landing

A landing page for mobx-router
JavaScript
3
star
37

stylz

Mixins and helpers for writing styles in JS
JavaScript
3
star
38

react-genie-styled-components

A set of animations for using react-genie with styled-components
TypeScript
3
star
39

postgres-s3-backups

TypeScript
2
star
40

hello-github-actions

2
star
41

kitze

1
star
42

react-academy-graphpack-starter

JavaScript
1
star
43

electrontest

electron
JavaScript
1
star
44

kitze-react-plopfile

My plop setup for quickly generating react components
1
star