1.0.2 • Published 6 months ago

component-transition-animation v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

ComponentTransitionAnimation

Getting Started

ComponentTransitionAnimation creates a fade out-in transition animation between components to help create a better user experience

Example

https://github.com/user-attachments/assets/c9904428-5bba-4d63-a1fc-87effdab5a77

Prerequisites

  • Node.js (>= 16.x)
  • npm (or yarn)

Installation

npm i component-transition-animation

Usage

"use client";

import React from 'react';
import ComponentTransitionAnimation from 'component-transition-animation';
import ProgressDemo from "../ProgressBar/index";
import RegisterEmailStage from "../RegisterEmailStage/index";
import RegisterPasswordStage from "../RegisterPasswordStage/index";
import RegisterSuccess from "../RegisterSuccess/index";
import { useUserRegister } from "@/providers/UserRegisterProvider/index";
import './index.css'

const RegisterPage = () => {
  const {
    currentStage
  } = useUserRegister();

  const registerStages: React.ReactNode[] = [
    <RegisterEmailStage />,
    <RegisterPasswordStage />,
    <RegisterSuccess />,
  ]

  return (
    <>
      <div className='rp-wrapper'>
        <div id='user-register-container' className='rp-form'>
          <h1 className='rp-h1'>Register</h1>
          <ProgressDemo progress={(currentStage / (registerStages.length - 1)) * 100} />
          <ComponentTransitionAnimation
            components={registerStages}
            currentStep={currentStage}
            transitionDuration={1000}
          />
        </div>
      </div>
    </>
  )
}

export default RegisterPage;

Props

PropDescriptionTypeRequiredDefaults to
componentsArray of components that are having their transtions animatedReact.ReactNode[]No[]
currentStepThe index of the component that is currently displayednumberYes-
transitionDurationThe duration of the transition in millisecondsnumberNo1000
styleThe styles to apply to the wrapper of the displayed componentReact.CSSPropertiesNo{}
containerStyleThe styles to apply to the container element that holds the componentsReact.CSSPropertiesNo{}
animationTypeThe type of timing function to apply to the transition (e.g., 'ease', 'ease-in-out', 'linear'), defaults to 'ease-in-out''ease' \| 'linear' \| 'ease-in' \| 'ease-out' \| 'ease-in-out' \| stringNo'ease-in-out'
1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago