diff --git a/src/components/new_ui/truth.tsx b/src/components/new_ui/truth.tsx index 3d19289..bc6c608 100644 --- a/src/components/new_ui/truth.tsx +++ b/src/components/new_ui/truth.tsx @@ -1,7 +1,13 @@ import { Box, HStack, Image, Stack, Text, Link, Flex } from '@chakra-ui/react' import { motion, useInView } from 'framer-motion' -import { colors } from '../../colors'; import { useEffect, useRef } from 'react'; + +const MotionBox = motion.create(Box) +const MotionStack = motion.create(Stack) +const MotionHStack = motion.create(HStack) +const MotionText = motion.create(Text) +const MotionImage = motion.create(Image) +const MotionFlex = motion.create(Flex) const truthItems = [ { @@ -59,7 +65,9 @@ function Truth() { ] const fbContainerRef = useRef(null); + const mainRef = useRef(null); const titleRef = useRef(null); + const isMainInView = useInView(mainRef, { once: true }); const isTitleInView = useInView(titleRef, { once: true }); @@ -99,25 +107,33 @@ function Truth() { return ( - - + textAlign={'center'} + initial={{ opacity: 0, y: -30 }} + animate={isMainInView ? { opacity: 1, y: 0 } : { opacity: 0, y: -30 }} + transition={{ duration: 0.6, delay: 0.2, ease: "easeOut" }} + > 想知道更多食用油健康真相? - + - - {truthItems.map((item) => ( - ( + - + - {renderDescription(item.desc)} - + - + ))} - + - - 點擊以下銷售點連結 - - + + - {shopImages.map((image, index) => ( - - + - + ))} - + - - salespoint - + - + )