From efa37da996b8d236608a5d59ed478324722b3fab Mon Sep 17 00:00:00 2001 From: philipcheung Date: Fri, 1 May 2026 16:57:43 +0800 Subject: [PATCH] update info and oilinfo, added animation to the "click to see recipe" section, and added alt and title attributes to images for better SEO and accessibility --- src/components/new_ui/info.tsx | 16 ++++++++++--- src/components/new_ui/oilInfo.tsx | 37 ++++++++++++++++++++++++++----- 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/src/components/new_ui/info.tsx b/src/components/new_ui/info.tsx index ff32757..d79c196 100644 --- a/src/components/new_ui/info.tsx +++ b/src/components/new_ui/info.tsx @@ -5,6 +5,7 @@ import { motion } from 'framer-motion' const MotionImage = motion.create(Image) const MotionFlex = motion.create(Flex) const MotionBox = motion.create(Box) +const MotionDiv = motion.div interface InfoData { id: number @@ -101,12 +102,20 @@ function Info() { transition={{ duration: 0.8, delay: 0.2, ease: "easeOut" }} > {infoData.map((info) => ( - setSelectedInfo(info.id)} + > + setSelectedInfo(info.id)} bg={selectedInfo === info.id ? '#3D6741' : '#BCBCBC'} border={selectedInfo === info.id ? { base: "1px solid #99BF35", sm: "1px solid #99BF35", md: "4px solid #99BF35", lg: "4px solid #99BF35", xl: "4px solid #99BF35" } : "none"} borderRadius={{ base: '15px', sm: '15px', md: '18px', lg: '20px', xl: '20px' }} @@ -126,6 +135,7 @@ function Info() { > {info.title} + ))} diff --git a/src/components/new_ui/oilInfo.tsx b/src/components/new_ui/oilInfo.tsx index 85e0e46..7c0bb67 100644 --- a/src/components/new_ui/oilInfo.tsx +++ b/src/components/new_ui/oilInfo.tsx @@ -1,11 +1,13 @@ -import { Box, Image, SimpleGrid } from '@chakra-ui/react' +import { Box, Image, SimpleGrid, Text } from '@chakra-ui/react' import { motion, useInView } from 'framer-motion' import { useRef } from 'react' -import {useRouterState } from '@tanstack/react-router' +import { useRouterState } from '@tanstack/react-router' const MotionImage = motion.create(Image) const MotionBox = motion.create(Box) +const MotionText = motion.create(Text) const MotionSimpleGrid = motion.create(SimpleGrid) +const MotionDiv = motion.div function OilInfo() { const mainRef = useRef(null); @@ -14,12 +16,12 @@ function OilInfo() { const handleRecipeNavigation = () => { const isOnRecipePage = location.pathname === '/40plus/recipe'; - + if (isOnRecipePage) { // Already on recipe page return; } - + // Navigate from main page - force reload to ensure Instagram embeds work window.location.href = '/40plus/recipe'; }; @@ -75,21 +77,44 @@ function OilInfo() { + + + 點擊了解更多食譜 + + + +