I currently have a menu form that allows users to add and remove items using React Transition Group.
Incorporating ReactJS:
<TransitionGroup>
{
menu.map(meal =>
<CSSTransition
key={meal.id}
timeout={500}
classNames="meMeals"
>
<Meal meal={meal} deleteFromMenu={deleteMealFromMenu}/>
</CSSTransition>
)
}
</TransitionGroup>
Here is the CSS used:
.meMeals-enter {
opacity: 0;
transform: translateY(-30px);
}
.meMeals-enter-active {
opacity: 1;
transform: translateY(0);
transition: all 500ms ease-in;
}
.meMeals-exit {
opacity: 1;
transform: translateY(0);
}
.meMeals-exit-active {
opacity: 0;
transform: translateY(-30px);
transition: all 500ms ease-in;
}
https://i.sstatic.net/4xJYn.png
Although I am satisfied with how the menu items behave, I now wish to implement smooth movements for the background element (grey) and the add button as new menu items appear or disappear. How can this be achieved?