mirror of
https://github.com/prymitive/karma
synced 2026-05-09 03:36:44 +00:00
feat(ui): add a dropdown animation
This commit is contained in:
33
ui/src/Components/Animations/DropdownSlide/index.css
Normal file
33
ui/src/Components/Animations/DropdownSlide/index.css
Normal file
@@ -0,0 +1,33 @@
|
||||
.components-animation-slide-enter,
|
||||
.components-animation-slide-appear {
|
||||
opacity: 0.01;
|
||||
overflow: hidden;
|
||||
max-height: 0px;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
.components-animation-slide-enter-active,
|
||||
.components-animation-slide-appear-active {
|
||||
max-height: 500px; /* can't use auto here */
|
||||
opacity: 1;
|
||||
transition-property: max-height, opacity;
|
||||
transition-duration: 0.15s;
|
||||
transition-timing-function: ease-out;
|
||||
}
|
||||
|
||||
.components-animation-slide-exit {
|
||||
max-height: 500px; /* can't use auto here */
|
||||
opacity: 1;
|
||||
}
|
||||
.components-animation-slide-exit-active {
|
||||
opacity: 0.01;
|
||||
overflow: hidden;
|
||||
max-height: 0px;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
transition-property: max-height, opacity;
|
||||
transition-duration: 0.15s;
|
||||
transition-timing-function: ease-out;
|
||||
}
|
||||
24
ui/src/Components/Animations/DropdownSlide/index.js
Normal file
24
ui/src/Components/Animations/DropdownSlide/index.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import { CSSTransition } from "react-transition-group";
|
||||
|
||||
import "./index.css";
|
||||
|
||||
const DropdownSlide = ({ children, duration, ...props }) => (
|
||||
<CSSTransition
|
||||
in={true}
|
||||
classNames="components-animation-slide"
|
||||
timeout={150}
|
||||
appear={true}
|
||||
exit={true}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
</CSSTransition>
|
||||
);
|
||||
DropdownSlide.propTypes = {
|
||||
children: PropTypes.node.isRequired
|
||||
};
|
||||
|
||||
export { DropdownSlide };
|
||||
Reference in New Issue
Block a user