From 616623cc909f8c501c541c12f278e0dc7220ac57 Mon Sep 17 00:00:00 2001 From: ruby10127130 Date: Sat, 28 Dec 2024 15:07:21 +0800 Subject: [PATCH 01/20] feat: adjust stepper bar sticky top position in marathon form --- components/Marathon/SignUp/StepperBar.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/Marathon/SignUp/StepperBar.jsx b/components/Marathon/SignUp/StepperBar.jsx index 374badb0..8e504015 100644 --- a/components/Marathon/SignUp/StepperBar.jsx +++ b/components/Marathon/SignUp/StepperBar.jsx @@ -16,7 +16,7 @@ export const StyledSaveBar = styled(Box)` box-shadow: 0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12); position: sticky; z-index: 99; - top: 118px; + top: 105px; width: 100%; left: 0; From a8944086d911ac4799eca4141c0306d964eddf22 Mon Sep 17 00:00:00 2001 From: ruby10127130 Date: Sat, 28 Dec 2024 15:10:57 +0800 Subject: [PATCH 02/20] chore: rename saveBar to stepperBar for clear meaning --- components/Marathon/SignUp/StepperBar.jsx | 8 ++++---- pages/learning-marathon/signup/index.jsx | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/Marathon/SignUp/StepperBar.jsx b/components/Marathon/SignUp/StepperBar.jsx index 8e504015..bae20269 100644 --- a/components/Marathon/SignUp/StepperBar.jsx +++ b/components/Marathon/SignUp/StepperBar.jsx @@ -4,7 +4,7 @@ import Stepper from '@mui/material/Stepper'; import Step from '@mui/material/Step'; import StepLabel from '@mui/material/StepLabel'; -export const StyledSaveBar = styled(Box)` +export const StyledStepperBar = styled(Box)` background-color: #FFF; padding: 15px 6.9vw; display: flex; @@ -58,9 +58,9 @@ export const StyledSaveBar = styled(Box)` } `; -export default function SaveBar({ currentStep }) { +export default function StepperBar({ currentStep }) { return ( - +

申請參加學習馬拉松

@@ -77,6 +77,6 @@ export default function SaveBar({ currentStep }) { -
+ ); } diff --git a/pages/learning-marathon/signup/index.jsx b/pages/learning-marathon/signup/index.jsx index b2414feb..d12fff17 100644 --- a/pages/learning-marathon/signup/index.jsx +++ b/pages/learning-marathon/signup/index.jsx @@ -10,7 +10,7 @@ import SEOConfig from '@/shared/components/SEO'; import Navigation from '@/shared/components/Navigation_v2'; import Footer from '@/shared/components/Footer_v2'; -import SaveBar from '@/components/Marathon/SignUp/StepperBar'; +import StepperBar from '@/components/Marathon/SignUp/StepperBar'; import UserProfileForm from '@/components/Marathon/SignUp/UserProfileForm'; import MarathonForm from '@/components/Marathon/SignUp/MarathonForm'; import ConfirmForm from '@/components/Marathon/SignUp/ConfirmForm'; @@ -102,7 +102,7 @@ const LearningMarathonSignUp = () => { return ( - + Date: Sat, 28 Dec 2024 18:10:28 +0800 Subject: [PATCH 03/20] feat: move showPromotionBar, setShowPromotionBar, headerHeight into NavigationContext --- contexts/Navigation.jsx | 27 +++++++++++++++++++++++ layout/DefaultLayout.jsx | 5 ++++- pages/join/index.jsx | 5 ++++- pages/learning-marathon/signup/index.jsx | 5 ++++- pages/learning-marathon/success/index.jsx | 5 ++++- pages/login/index.jsx | 5 ++++- pages/meet/index.jsx | 5 ++++- pages/partner/detail/index.jsx | 5 ++++- pages/partner/index.jsx | 5 ++++- pages/profile/index.jsx | 5 ++++- pages/profile/myprofile/index.jsx | 5 ++++- shared/components/Navigation_v2/index.jsx | 17 +++++--------- 12 files changed, 73 insertions(+), 21 deletions(-) create mode 100644 contexts/Navigation.jsx diff --git a/contexts/Navigation.jsx b/contexts/Navigation.jsx new file mode 100644 index 00000000..bd6fa627 --- /dev/null +++ b/contexts/Navigation.jsx @@ -0,0 +1,27 @@ +import { useEffect, useState, useContext, createContext } from 'react'; + +const NavigationContext = createContext(); + +export const useNavigation = () => { + const context = useContext(NavigationContext); + if (!context) { + throw new Error('useNavigation must be used within an NavigationProvider'); + } + return context; +} +export const NavigationProvider = ({ children }) => { + const [showPromotionBar, setShowPromotionBar] = useState(true); + const [headerHeight, setHeaderHeight] = useState('128px'); + useEffect(() => { + setHeaderHeight(showPromotionBar ? '128px' : '64px'); + }, [showPromotionBar]); + return ( + + {children} + + ); +}; \ No newline at end of file diff --git a/layout/DefaultLayout.jsx b/layout/DefaultLayout.jsx index 37894a47..25ed38ec 100644 --- a/layout/DefaultLayout.jsx +++ b/layout/DefaultLayout.jsx @@ -1,11 +1,14 @@ import React from 'react'; import Navigation from '@/shared/components/Navigation_v2'; import Footer from '@/shared/components/Footer_v2'; +import { NavigationProvider } from '@/contexts/Navigation'; const DefaultLayout = ({ children }) => { return ( <> - + + + {children}