'use client'
import { useState } from 'react'
import { Navigation } from '@/components/Navigation'
import { ProtectedRoute } from '@/components/ProtectedRoute'
export default function VocabDesignsPage() {
return (
)
}
function VocabDesignsContent() {
const [selectedDesign, setSelectedDesign] = useState('modern')
const [showPopup, setShowPopup] = useState(false)
// 假詞彙數據
const mockWord = {
word: 'elaborate',
pronunciation: '/ɪˈlæbərət/',
partOfSpeech: 'verb',
translation: '詳細說明',
definition: 'To explain something in more detail; to develop or present a theory, policy, or system in further detail',
synonyms: ['explain', 'detail', 'expand', 'clarify'],
difficultyLevel: 'B2',
isHighValue: true,
example: 'Could you elaborate on your proposal?',
exampleTranslation: '你能詳細說明一下你的提案嗎?'
}
const designs = [
{ id: 'modern', name: '現代玻璃', description: '毛玻璃效果,現代感設計' },
{ id: 'classic', name: '經典卡片', description: '傳統卡片風格,清晰分區' },
{ id: 'minimal', name: '極簡風格', description: '簡潔乾淨,突出重點' },
{ id: 'magazine', name: '雜誌排版', description: '類似雜誌的排版風格' },
{ id: 'mobile', name: '移動應用', description: 'iOS/Android應用風格' },
{ id: 'learning', name: '學習卡片', description: '與學習功能一致的風格' }
]
return (
{/* 頁面標題 */}
詞彙明細版型展示
6種不同風格的詞彙彈窗設計
{/* 測試詞彙 */}
測試詞彙:
{/* 版型選擇器 */}
{designs.map((design) => (
))}
{/* 版型預覽 */}
{/* 左側:版型說明 */}
{designs.find(d => d.id === selectedDesign)?.name}
{designs.find(d => d.id === selectedDesign)?.description}
設計特色
{getDesignFeatures(selectedDesign).map((feature, idx) => (
-
•
{feature}
))}
適用場景
{getDesignScenario(selectedDesign)}
{/* 右側:版型預覽 */}
點擊下方按鈕預覽版型效果
{/* 模擬背景文字 */}
This is a sample sentence where you can click on any word to see the elaborate definition and detailed explanation.
{/* 詞彙彈窗 - 根據選擇的設計風格渲染 */}
{showPopup && (
<>
{/* 背景遮罩 */}
setShowPopup(false)}
/>
{/* 彈窗內容 */}
{renderVocabPopup(selectedDesign, mockWord, () => setShowPopup(false))}
>
)}
)
}
// 渲染不同風格的詞彙彈窗
function renderVocabPopup(design: string, word: any, onClose: () => void) {
const handleSave = () => {
alert(`✅ 已將「${word.word}」保存到詞卡!`)
onClose()
}
switch (design) {
case 'modern':
return
case 'classic':
return
case 'minimal':
return
case 'magazine':
return
case 'mobile':
return
case 'learning':
return
default:
return
}
}
// 1. 現代玻璃風格
function ModernGlassDesign({ word, onClose, onSave }: any) {
return (
{word.word}
{word.isHighValue && ⭐}
{word.pronunciation}
{word.difficultyLevel}
同義詞
{word.synonyms.map((synonym: string, idx: number) => (
{synonym}
))}
)
}
// 2. 經典卡片風格
function ClassicCardDesign({ word, onClose, onSave }: any) {
return (
{word.word}
{word.pronunciation}
{word.partOfSpeech}
{word.difficultyLevel}
{word.isHighValue && (
⭐ 高價值
)}
同義詞
{word.synonyms.map((synonym: string, idx: number) => (
{synonym}
))}
)
}
// 3. 極簡風格
function MinimalDesign({ word, onClose, onSave }: any) {
return (
{word.word}
{word.pronunciation}
{word.translation}
({word.partOfSpeech})
{word.definition}
{word.synonyms.slice(0, 3).map((synonym: string, idx: number) => (
{synonym}
))}
)
}
// 4. 雜誌排版風格
function MagazineDesign({ word, onClose, onSave }: any) {
return (
{word.word}
{word.pronunciation}
{word.partOfSpeech}
{word.difficultyLevel}
Translation
{word.translation}
Definition
{word.definition}
Synonyms
{word.synonyms.join(', ')}
)
}
// 5. 移動應用風格
function MobileAppDesign({ word, onClose, onSave }: any) {
return (
{word.word[0].toUpperCase()}
詞彙詳情
{word.word}
{word.pronunciation}
{word.partOfSpeech}
{word.difficultyLevel}
🔗
{word.synonyms.slice(0, 3).map((synonym: string, idx: number) => (
{synonym}
))}
同義詞
)
}
// 6. 學習卡片風格
function LearningCardDesign({ word, onClose, onSave }: any) {
return (
{word.word[0].toUpperCase()}
{word.word}
{word.partOfSpeech}
同義詞
{word.synonyms.map((synonym: string, idx: number) => (
{synonym}
))}
)
}
// 輔助函數
function getDesignFeatures(design: string): string[] {
const features = {
modern: [
'毛玻璃背景效果',
'大尺寸陰影和圓角',
'漸層按鈕設計',
'微互動動畫',
'現代配色方案'
],
classic: [
'藍色漸層標題欄',
'清晰的區塊分隔',
'傳統卡片佈局',
'顏色編碼標籤',
'穩重的設計風格'
],
minimal: [
'極簡配色方案',
'去除多餘裝飾',
'重點信息突出',
'輕量化設計',
'快速瀏覽體驗'
],
magazine: [
'雜誌式字體',
'專業排版設計',
'大標題小說明',
'黑白主色調',
'閱讀導向佈局'
],
mobile: [
'iOS/Android風格',
'圓角和圖標設計',
'列表式信息展示',
'觸控友好設計',
'移動端優化'
],
learning: [
'學習功能一致性',
'彩色區塊設計',
'教育導向佈局',
'清晰的信息分類',
'學習體驗優化'
]
}
return features[design as keyof typeof features] || []
}
function getDesignScenario(design: string): string {
const scenarios = {
modern: '適合追求現代感和科技感的用戶,特別是年輕用戶群體。設計前衛,視覺效果佳。',
classic: '適合喜歡傳統界面的用戶,信息展示清晰,功能分區明確,適合學術或商務場景。',
minimal: '適合追求效率的用戶,減少視覺干擾,快速獲取核心信息,適合頻繁使用的場景。',
magazine: '適合喜歡閱讀體驗的用戶,類似字典或雜誌的專業排版,適合深度學習。',
mobile: '適合手機用戶,觸控友好,符合移動端應用的使用習慣,適合隨時隨地學習。',
learning: '與現有學習功能保持一致,用戶體驗連貫,適合在學習流程中使用。'
}
return scenarios[design as keyof typeof scenarios] || ''
}