dramaling-vocab-learning/docs/02_design/design-system/components/web-components.md

17 KiB
Raw Blame History

Web端特化組件設計規範

概述

Drama Ling Web端專屬組件設計標準充分發揮Web端大螢幕、多視窗、鍵盤快捷鍵等優勢提供優於移動端的學習體驗和操作效率。

🗂️ 多標籤對話界面設計標準

標籤頁基礎設計

基於Web端多任務處理優勢設計的對話管理系統

.dialogue-tabs-container {
  background: white;
  border-bottom: 2px solid #E5E7EB;
  padding: 0 20px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #D1D5DB #F9FAFB;
}

.dialogue-tabs {
  display: flex;
  gap: 2px;
  min-width: fit-content;
}

.dialogue-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  background: #F9FAFB;
  color: #6B7280;
  border-radius: 8px 8px 0 0;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 160px;
  max-width: 220px;
  position: relative;
}

.dialogue-tab:hover {
  background: #F3F4F6;
  color: #374151;
}

.dialogue-tab.active {
  background: white;
  color: #1F2937;
  border-bottom: 2px solid white;
  margin-bottom: -2px;
  font-weight: 600;
}

.dialogue-tab.completed {
  background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
  color: #059669;
}

.dialogue-tab.in-progress {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  color: #D97706;
}

標籤內容區域

.dialogue-tab-content {
  display: none;
  padding: 24px;
  background: white;
  min-height: 600px;
}

.dialogue-tab-content.active {
  display: block;
  animation: tab-fade-in 0.3s ease-out;
}

@keyframes tab-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

標籤操作元素

.tab-info {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.tab-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.tab-title {
  margin-left: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 8px;
  flex-shrink: 0;
}

.tab-status.completed {
  background: #10B981;
}

.tab-status.in-progress {
  background: #F59E0B;
}

.tab-status.pending {
  background: #D1D5DB;
}

.tab-close {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.2s ease;
  margin-left: 8px;
  flex-shrink: 0;
}

.dialogue-tab:hover .tab-close {
  opacity: 1;
}

.tab-close:hover {
  background: #F3F4F6;
}

快捷鍵支援

.keyboard-shortcut {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 10px;
  color: #9CA3AF;
  background: rgba(255, 255, 255, 0.8);
  padding: 1px 4px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.dialogue-tab:hover .keyboard-shortcut {
  opacity: 1;
}

.keyboard-shortcut.pressed {
  background: #6366F1;
  color: white;
}

📊 大螢幕統計面板設計規範

統計面板佈局

.statistics-dashboard {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: auto 1fr auto;
  gap: 20px;
  padding: 24px;
  min-height: 100vh;
  background: #F9FAFB;
}

.dashboard-header {
  grid-column: 1 / -1;
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.main-statistics {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: auto;
}

.sidebar-widgets {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dashboard-footer {
  grid-column: 1 / -1;
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

統計卡片組件

.stat-card {
  background: white;
  border-radius: 8px;
  border: 1px solid #E5E7EB;
  padding: 20px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.stat-card:hover {
  border-color: #6366F1;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: between;
  margin-bottom: 16px;
}

.stat-icon {
  width: 32px;
  height: 32px;
  padding: 6px;
  background: #EEF2FF;
  border-radius: 8px;
  color: #6366F1;
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  color: #1F2937;
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 14px;
  color: #6B7280;
  font-weight: 500;
}

.stat-change {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  margin-top: 8px;
}

.stat-change.positive {
  color: #10B981;
}

.stat-change.negative {
  color: #EF4444;
}

.stat-change-icon {
  width: 12px;
  height: 12px;
}

互動式圖表區域

.chart-container {
  position: relative;
  background: #FAFBFC;
  border-radius: 8px;
  padding: 20px;
  margin: 16px 0;
  min-height: 300px;
}

.chart-header {
  display: flex;
  justify-content: between;
  align-items: center;
  margin-bottom: 20px;
}

.chart-title {
  font-size: 16px;
  font-weight: 600;
  color: #1F2937;
}

.chart-controls {
  display: flex;
  gap: 8px;
}

.chart-control-btn {
  padding: 6px 12px;
  border: 1px solid #D1D5DB;
  background: white;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chart-control-btn.active {
  background: #6366F1;
  color: white;
  border-color: #6366F1;
}

.chart-canvas {
  width: 100%;
  height: 100%;
  min-height: 260px;
}

即時更新指示器

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: #ECFDF5;
  border: 1px solid #10B981;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  color: #059669;
}

.live-dot {
  width: 6px;
  height: 6px;
  background: #10B981;
  border-radius: 50%;
  animation: live-pulse 2s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

🔐 企業SSO界面標準

SSO登入頁面設計

.enterprise-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
}

.enterprise-login::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><g fill="%23ffffff" fill-opacity="0.05"><circle cx="30" cy="30" r="4"/></g></svg>') repeat;
}

.sso-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  padding: 40px;
  width: 100%;
  max-width: 480px;
  position: relative;
  z-index: 1;
}

.enterprise-logo {
  text-align: center;
  margin-bottom: 32px;
}

.company-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  border-radius: 12px;
  background: #F3F4F6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.company-name {
  font-size: 18px;
  font-weight: 600;
  color: #1F2937;
  margin-bottom: 8px;
}

.sso-subtitle {
  font-size: 14px;
  color: #6B7280;
  text-align: center;
}

SSO提供商按鈕

.sso-providers {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 32px 0;
}

.sso-provider-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 24px;
  border: 2px solid #E5E7EB;
  border-radius: 12px;
  background: white;
  color: #374151;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}

.sso-provider-btn:hover {
  border-color: #6366F1;
  background: #F8FAFC;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.sso-provider-btn:active {
  transform: translateY(0);
}

.sso-provider-btn.microsoft {
  border-color: #0078D4;
}

.sso-provider-btn.microsoft:hover {
  background: #F3F9FF;
  border-color: #0078D4;
}

.sso-provider-btn.google {
  border-color: #4285F4;
}

.sso-provider-btn.google:hover {
  background: #F8FBFF;
  border-color: #4285F4;
}

.sso-provider-btn.okta {
  border-color: #007DC1;
}

.sso-provider-btn.okta:hover {
  background: #F0F9FF;
  border-color: #007DC1;
}

.provider-icon {
  width: 24px;
  height: 24px;
}

企業資訊顯示

.enterprise-info {
  background: #F8FAFC;
  border-radius: 8px;
  padding: 16px;
  margin: 24px 0;
  border: 1px solid #E2E8F0;
}

.enterprise-domain {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.domain-icon {
  width: 16px;
  height: 16px;
  color: #6366F1;
}

.domain-text {
  font-size: 14px;
  font-weight: 500;
  color: #1E293B;
}

.enterprise-features {
  list-style: none;
  padding: 0;
  margin: 0;
}

.enterprise-features li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #64748B;
  margin-bottom: 8px;
}

.feature-icon {
  width: 12px;
  height: 12px;
  color: #10B981;
}

🖥️ 多視窗管理界面規範

視窗管理器設計

.window-manager {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #1F2937;
  z-index: 1000;
  display: none;
}

.window-manager.active {
  display: flex;
  flex-direction: column;
}

.window-manager-header {
  background: #374151;
  padding: 12px 20px;
  display: flex;
  justify-content: between;
  align-items: center;
  border-bottom: 1px solid #4B5563;
}

.window-manager-title {
  color: white;
  font-size: 14px;
  font-weight: 600;
}

.window-manager-controls {
  display: flex;
  gap: 8px;
}

.window-control-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  background: #4B5563;
  color: #D1D5DB;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.window-control-btn:hover {
  background: #6B7280;
  color: white;
}

視窗預覽網格

.window-grid {
  flex: 1;
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  overflow: auto;
}

.window-preview {
  aspect-ratio: 16 / 10;
  background: white;
  border-radius: 8px;
  border: 2px solid #4B5563;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.window-preview:hover {
  border-color: #6366F1;
  transform: scale(1.02);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.window-preview.active {
  border-color: #10B981;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.window-preview-header {
  background: #F3F4F6;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #E5E7EB;
}

.window-preview-dots {
  display: flex;
  gap: 4px;
}

.preview-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #D1D5DB;
}

.preview-dot.close {
  background: #EF4444;
}

.preview-dot.minimize {
  background: #F59E0B;
}

.preview-dot.maximize {
  background: #10B981;
}

.window-preview-title {
  font-size: 12px;
  font-weight: 500;
  color: #6B7280;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.window-preview-content {
  padding: 12px;
  height: calc(100% - 40px);
  background: white;
  overflow: hidden;
  position: relative;
}

視窗操作面板

.window-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 6px;
  padding: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
  display: flex;
  gap: 4px;
}

.window-preview:hover .window-actions {
  opacity: 1;
}

.window-action-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: background 0.2s ease;
}

.window-action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.window-action-btn.close:hover {
  background: #EF4444;
}

⌨️ 鍵盤快捷鍵系統

快捷鍵提示界面

.keyboard-shortcuts-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.keyboard-shortcuts-overlay.visible {
  display: flex;
}

.shortcuts-panel {
  background: white;
  border-radius: 16px;
  padding: 32px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.shortcuts-header {
  text-align: center;
  margin-bottom: 32px;
}

.shortcuts-title {
  font-size: 24px;
  font-weight: 700;
  color: #1F2937;
  margin-bottom: 8px;
}

.shortcuts-subtitle {
  font-size: 14px;
  color: #6B7280;
}

.shortcuts-sections {
  display: grid;
  gap: 24px;
}

.shortcuts-section {
  background: #F9FAFB;
  border-radius: 8px;
  padding: 20px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-icon {
  width: 20px;
  height: 20px;
}

.shortcuts-list {
  display: grid;
  gap: 12px;
}

.shortcut-item {
  display: flex;
  justify-content: between;
  align-items: center;
  padding: 8px 0;
}

.shortcut-description {
  font-size: 14px;
  color: #374151;
}

.shortcut-keys {
  display: flex;
  gap: 4px;
  align-items: center;
}

.key {
  padding: 4px 8px;
  background: white;
  border: 1px solid #D1D5DB;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  min-width: 24px;
  text-align: center;
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

.key-separator {
  font-size: 12px;
  color: #9CA3AF;
  margin: 0 4px;
}

快捷鍵視覺回饋

.shortcut-feedback {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transform: translateX(100px);
  transition: all 0.3s ease;
}

.shortcut-feedback.active {
  opacity: 1;
  transform: translateX(0);
}

.shortcut-feedback.success {
  background: rgba(16, 185, 129, 0.9);
}

.shortcut-feedback.error {
  background: rgba(239, 68, 68, 0.9);
}

📱 響應式適配方案

Tablet 適配 (768px - 1023px)

@media (max-width: 1023px) {
  .statistics-dashboard {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
  }
  
  .dialogue-tabs-container {
    padding: 0 16px;
  }
  
  .dialogue-tab {
    min-width: 140px;
    padding: 10px 16px;
  }
  
  .window-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    padding: 16px;
  }
  
  .shortcuts-panel {
    padding: 24px;
    width: 95%;
  }
}

Mobile 降級處理 (<768px)

@media (max-width: 767px) {
  .dialogue-tabs-container {
    display: none;
  }
  
  .dialogue-content {
    padding: 16px;
  }
  
  .statistics-dashboard {
    display: block;
    padding: 12px;
  }
  
  .stat-card {
    margin-bottom: 16px;
  }
  
  .window-manager {
    display: none !important;
  }
  
  .enterprise-login {
    padding: 20px;
  }
  
  .sso-card {
    padding: 24px;
  }
  
  .shortcuts-panel {
    padding: 20px;
    width: 100%;
    height: 100vh;
    border-radius: 0;
  }
}

無障礙設計要求

鍵盤導航支援

.focusable-element:focus-visible {
  outline: 3px solid #6366F1;
  outline-offset: 2px;
}

.tab-content[aria-hidden="true"] {
  display: none;
}

.window-preview[aria-selected="true"] {
  border-color: #10B981;
}

語音輔助標籤

<!-- 多標籤界面 -->
<div role="tablist" aria-label="對話管理標籤">
  <button role="tab" 
          aria-selected="true" 
          aria-controls="dialogue-1"
          aria-describedby="tab-shortcut-1">
    劇本一對話
  </button>
</div>

<!-- 統計面板 -->
<div role="region" 
     aria-label="學習統計面板"
     aria-live="polite">
  <div role="grid" aria-label="統計數據表格">
    <!-- 統計內容 -->
  </div>
</div>

<!-- 視窗管理器 -->
<div role="application" 
     aria-label="多視窗管理器"
     aria-describedby="window-manager-help">
  <div role="grid" 
       aria-label="開啟視窗預覽"
       aria-rowcount="var(--row-count)"
       aria-colcount="var(--col-count)">
    <!-- 視窗預覽 -->
  </div>
</div>

🔧 實現檢查清單

基礎功能

  • 多標籤對話界面實現
  • 大螢幕統計面板佈局
  • 企業SSO登入頁面
  • 基礎視窗管理功能
  • 鍵盤快捷鍵系統

進階功能

  • 標籤拖拽排序
  • 統計面板自定義佈局
  • 多SSO提供商整合
  • 視窗預覽即時更新
  • 快捷鍵自定義功能

品質檢查

  • 響應式設計測試
  • 鍵盤導航完整性
  • 無障礙標籤合規
  • 跨瀏覽器兼容性
  • 性能載入測試

文件版本: v1.0
創建日期: 2025-09-12
維護團隊: Drama Ling UI/UX 設計團隊
相關文檔: