Answer the question
In order to leave comments, you need to log in
How to smoothly hide a block in react application?
Guys, tell me how to add animation to a block that opens and closes depending on the flag.
const SearchModal = ({ isOpen }) =>
isOpen && <div className={cn('wrap', isOpen ? 'active' : 'showed')}>
.wrap {
display: flex;
align-items: start;
width: 100%;
&.active {
animation: active .5s;
animation-fill-mode: forwards;
animation-iteration-count: 1;
}
&.showed {
animation: active .5s;
animation-fill-mode: forwards;
animation-iteration-count: 1;
}
}
@keyframes active {
0% {
opacity: 0;
transform: translateY(30%);
}
100% {
opacity: 1;
transform: translateY(0%);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question