Skip to content

Commit

Permalink
fix framer-motion
Browse files Browse the repository at this point in the history
  • Loading branch information
hervedombya committed Sep 12, 2023
1 parent 1b6225c commit 8433c43
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 40 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
"@fortawesome/free-solid-svg-icons": "^5.15.3",
"@fortawesome/react-fontawesome": "^0.1.14",
"@js-temporal/polyfill": "^0.4.3",
"framer-motion": "^5.6.0",
"polished": "3.4.1",
"pretty-bytes": "^5.6.0",
"react": "^17.0.2",
Expand Down
3 changes: 3 additions & 0 deletions src/framer-motion.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module 'framer-motion/dist/framer-motion' {
export * from 'framer-motion';
}
76 changes: 37 additions & 39 deletions src/lib/components/toast/Toast.component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AnimatePresence, motion } from 'framer-motion/dist/framer-motion';
import { motion } from 'framer-motion/dist/framer-motion';
import React, { useRef } from 'react';
import { useTheme } from 'styled-components';
import { Box } from '../box/Box';
Expand Down Expand Up @@ -144,45 +144,43 @@ function Toast({
width,
}}
>
<AnimatePresence>
<motion.div
key="toast"
initial={{ opacity: 0, y: -20 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: 20 }}
transition={{ duration: 0.3 }}
style={{
alignItems: 'flex-end',
backgroundColor: theme.backgroundLevel1,
borderColor: theme.border,
border: '1px solid',
display: 'flex',
borderRadius: '4px',
position: 'relative',
}}
>
<IconContainer bgColor={rgbBgColor}>{icon}</IconContainer>
<ContentContainer>
<BasicText>
{message}
<br />
{action}
</BasicText>
</ContentContainer>
<Box display="flex" alignItems="center" alignSelf="stretch">
<Button
icon={<Icon name="Close" size="lg" color="textSecondary" />}
onClick={params?.onClose}
/>
</Box>
</motion.div>
{withProgressBar && (
<ToastProgressBar
duration={autoDismiss ? duration : null}
color={bgColor}
<motion.div
key="toast"
initial={{ opacity: 0, y: -20 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: 20 }}
transition={{ duration: 0.3 }}
style={{
alignItems: 'flex-end',
backgroundColor: theme.backgroundLevel1,
borderColor: theme.border,
border: '1px solid',
display: 'flex',
borderRadius: '4px',
position: 'relative',
}}
>
<IconContainer bgColor={rgbBgColor}>{icon}</IconContainer>
<ContentContainer>
<BasicText>
{message}
<br />
{action}
</BasicText>
</ContentContainer>
<Box display="flex" alignItems="center" alignSelf="stretch">
<Button
icon={<Icon name="Close" size="lg" color="textSecondary" />}
onClick={params?.onClose}
/>
)}
</AnimatePresence>
</Box>
</motion.div>
{withProgressBar && (
<ToastProgressBar
duration={autoDismiss ? duration : null}
color={bgColor}
/>
)}
</div>
);
}
Expand Down

0 comments on commit 8433c43

Please sign in to comment.