feat: 新增 i18n 多語系、淺色深色主題設計、常見 QA 問答區、月付/年付切換、載入時的 loading 頁面、Cookie 同意彈窗#1
Open
dean9703111 wants to merge 1 commit intomasterfrom
Open
feat: 新增 i18n 多語系、淺色深色主題設計、常見 QA 問答區、月付/年付切換、載入時的 loading 頁面、Cookie 同意彈窗#1dean9703111 wants to merge 1 commit intomasterfrom
dean9703111 wants to merge 1 commit intomasterfrom
Conversation
…ng 頁面、Cookie 同意彈窗
5dcf5d6 to
6ad338e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 為什麼要這樣做
為 SalesPilot CRM Landing Page 增加六大功能,提升使用者體驗與國際化能力。所有功能均使用 React Context + CSS Custom Properties 實作,未引入任何新 npm 依賴。
I18n 多語系系統(
I18nContext.jsx、locales.js)I18nContext,透過localStorage持久化語系偏好(預設zh,可切換en)locales.js完整翻譯檔(326 行),涵蓋 Nav、Hero、Features、SocialProof、UseCases、Pricing、CTA、FAQ、Footer、Cookie、Loading 所有文案t(key)函式支援 dot-notation 取值,並支援巢狀物件與陣列淺色 / 深色主題切換(
ThemeContext.jsx、index.css)ThemeContext,透過localStorage持久化主題偏好,同步更新document.documentElement的data-theme屬性[data-theme='light']選擇器,覆寫背景、文字、卡片、邊框、陰影等所有色彩變數Navbar(
Navbar.jsx)useTheme與useI18n,新增主題切換按鈕(🌙/☀️)與語系切換按鈕(EN/中)getLabel(href)映射翻譯鍵值FAQ 問答區(
FAQ.jsx、index.css)faq鍵值驅動,開合狀態以useState管理月付 / 年付切換(
Pricing.jsx、pricing.js)billingCyclestate 與 toggle UIpricing__toggle-*priceValue * 10 * 0.8)priceValue欄位,Enterprise 方案(priceValue: null)維持「聯繫我們」Loading 頁面(
Loading.jsx、index.css)App.jsx以useEffect+setTimeout模擬 1.5 秒載入延遲Cookie 同意彈窗(
CookieConsent.jsx、index.css)slideUp入場動畫localStorage記錄使用者同意狀態,同意後不再顯示其他元件 i18n 改造
Hero.jsx:標題、副標題、CTA、統計數據、mockup 欄位標題改由t()驅動Features.jsx:區塊標題、描述、功能列表改由t()驅動SocialProof.jsx:標題與 testimonial 改由t()驅動UseCases.jsx:區塊標題、角色描述、highlights 改由t()驅動,靜態 icon/id 透過 index 合併CallToAction.jsx:標題、描述、按鈕文字改由t()驅動Footer.jsx:品牌描述、版權、欄位標題與連結改由t()驅動App 入口(
App.jsx、main.jsx)main.jsx包裹ThemeProvider→I18nProvider→AppApp.jsx新增 Loading 狀態判斷、引入FAQ與CookieConsent元件🧪 測試步驟
測試案例 1:i18n 語系切換
測試案例 2:淺色 / 深色主題切換
測試案例 3:FAQ 問答區展開 / 收合
測試案例 4:月付 / 年付切換
測試案例 5:Loading 頁面
測試案例 6:Cookie 同意彈窗
localStorage後重新整理頁面slideUp入場動畫