Skip to content

Commit

Permalink
feat: add customAnimation
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanOliveiraM committed Mar 5, 2023
1 parent ed4c34f commit 220148f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"react",
"typescript"
],
"version": "2.1.20",
"version": "2.1.21",
"main": "./dist/index.cjs.js",
"module": "./dist/index.esm.js",
"types": "./dist/index.d.ts",
Expand Down
18 changes: 10 additions & 8 deletions src/components/molecules/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type ModalFunctionNotation = {
}

export type ModalProps = {
animation?: {
customAnimation?: {
initial?: AnimationProps['initial']
transition?: AnimationProps['transition']
in?: AnimationProps['animate']
Expand All @@ -48,7 +48,7 @@ export type ModalProps = {
} & Omit<CardProps, 'children'>

const ModalBase = ({
animation,
customAnimation,
render,
onClickOutside,
externalIsOpen,
Expand Down Expand Up @@ -94,12 +94,14 @@ const ModalBase = ({
{modalIsOpen ? (
<motion.div
{...motionContainerProps}
initial={animation?.initial ? animation.initial : { opacity: 0 }}
animate={animation?.in ? animation.in : { opacity: 1 }}
exit={animation?.out ? animation.out : { opacity: 0 }}
initial={
customAnimation?.initial ? customAnimation.initial : { opacity: 0 }
}
animate={customAnimation?.in ? customAnimation.in : { opacity: 1 }}
exit={customAnimation?.out ? customAnimation.out : { opacity: 0 }}
transition={
animation?.transition
? animation.transition
customAnimation?.transition
? customAnimation.transition
: {
default: { duration: 0.3 },
}
Expand All @@ -121,7 +123,7 @@ const ModalBase = ({

ModalBase.defaultProps = {
children: undefined,
animation: undefined,
customAnimation: undefined,
onClickOutside: undefined,
externalIsOpen: undefined,
backgroundProps: undefined,
Expand Down

0 comments on commit 220148f

Please sign in to comment.