Skip to content

Commit

Permalink
Update to Nextjs13
Browse files Browse the repository at this point in the history
  • Loading branch information
aramceballos committed Feb 20, 2023
1 parent 245472d commit 8b41e61
Show file tree
Hide file tree
Showing 11 changed files with 1,992 additions and 22,366 deletions.
33 changes: 21 additions & 12 deletions components/Fade/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,33 @@ const Fade = ({
duration,
distance,
}: FadeProps) => {
const uniqueId = Math.random().toString(36).substr(2, 9);

const childrenWithClassName = React.Children.map(children, (child) => {
if (React.isValidElement(child)) {
return React.cloneElement(child, {
style: {
animationFillMode: "both",
animationDuration: duration ? duration + "ms" : "0ms",
animationDelay: delay ? delay + "ms" : "0ms",
animationIterationCount: 1,
opacity: 1,
animationName: `fade-animation-${uniqueId}`,
},
});
}
return child;
});

return (
<>
<div className='fade-container'>{children}</div>
{childrenWithClassName}
<style jsx>{`
.fade-container {
animation-fill-mode: both;
animation-duration: ${duration + "ms" || "0ms"};
animation-delay: ${delay + "ms" || "0ms"};
animation-iteration-count: 1;
opacity: 1;
animation-name: fade-animation;
}
@keyframes fade-animation {
@keyframes fade-animation-${uniqueId} {
0% {
opacity: 0;
transform: translate3d(
${left ? "-" + distance : right ? "-" + distance : 0},
${left ? "-" + distance : right ? distance : 0},
${bottom ? "-" + distance : 0},
0
);
Expand Down
14 changes: 4 additions & 10 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
const isProd = process.env.NODE_ENV === 'production';
const nextConfig = {
reactStrictMode: true,
};

const withPWA = require('next-pwa');

module.exports = withPWA({
pageExtensions: ['tsx'],
pwa: {
disable: !isProd,
dest: 'public',
},
});
module.exports = nextConfig;
Loading

0 comments on commit 8b41e61

Please sign in to comment.