diff --git a/src/components/TemplateCard/index.css b/src/components/TemplateCard/index.css index f0f97a8..c42d716 100644 --- a/src/components/TemplateCard/index.css +++ b/src/components/TemplateCard/index.css @@ -20,20 +20,20 @@ box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15); } -/* 左右对比区域 */ +/* 合成对比图片区域 */ .image-comparison { position: relative; padding: 16px; background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%); } -.split-container { +.merged-image-container { position: relative; - display: flex; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); height: 180px; + display: flex; } .image-half { @@ -42,16 +42,8 @@ overflow: hidden; } -.left-half { - border-right: 1px solid rgba(255, 255, 255, 0.3); -} - -.right-half { - border-left: 1px solid rgba(255, 255, 255, 0.3); -} - .comparison-image { - width: 100%; + width: 200%; /* 图片宽度设为容器的2倍 */ height: 100%; object-fit: cover; display: block; @@ -59,28 +51,49 @@ transition: opacity 0.3s ease; } +/* 左半部分显示原图的左半部分 */ +.left-image { + transform: translateX(0); /* 不偏移,显示图片左半部分 */ +} + +/* 右半部分显示效果图的右半部分 */ +.right-image { + transform: translateX(-50%); /* 向左偏移50%,显示图片右半部分 */ +} + .comparison-image:not([src]) { opacity: 0.5; } -.image-label { +/* 标签容器 */ +.image-labels { position: absolute; - bottom: 8px; - left: 50%; - transform: translateX(-50%); - padding: 4px 12px; - border-radius: 16px; + bottom: 0; + left: 0; + right: 0; + display: flex; + z-index: 2; +} + +.label-left, +.label-right { + flex: 1; + display: flex; + justify-content: center; + align-items: center; + padding: 8px 4px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); - white-space: nowrap; } -.input-label { +.label-left { background: rgba(52, 152, 219, 0.9); + border-radius: 0 0 0 12px; } -.output-label { +.label-right { background: rgba(46, 204, 113, 0.9); + border-radius: 0 0 12px 0; } .label-text { @@ -90,12 +103,12 @@ text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); } -/* 分割线和拖拽手柄 */ +/* 分割线和手柄 */ .split-line { position: absolute; left: 50%; - top: 16px; - bottom: 16px; + top: 0; + bottom: 0; width: 2px; background: linear-gradient(to bottom, rgba(255, 255, 255, 0.8) 0%, @@ -110,19 +123,19 @@ top: 50%; left: 50%; transform: translate(-50%, -50%); - width: 32px; - height: 32px; + width: 28px; + height: 28px; background: rgba(255, 255, 255, 0.95); border-radius: 50%; display: flex; align-items: center; justify-content: center; - box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15); - border: 2px solid rgba(0, 122, 255, 0.2); + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); + border: 2px solid rgba(0, 122, 255, 0.3); } .split-icon { - font-size: 14px; + font-size: 12px; color: #007AFF; font-weight: bold; } diff --git a/src/components/TemplateCard/index.tsx b/src/components/TemplateCard/index.tsx index 1604a52..4e98f7f 100644 --- a/src/components/TemplateCard/index.tsx +++ b/src/components/TemplateCard/index.tsx @@ -14,37 +14,44 @@ export default function TemplateCard({ template, onClick }: TemplateCardProps) { return ( - {/* 左右对比区域 */} + {/* 合成对比图片区域 */} - + + {/* 左半部分 - 原图的左半部分 */} - - 原图 - + {/* 右半部分 - 效果图的右半部分 */} - - 效果 + + + {/* 中央分割线 */} + + + - - - - + {/* 标签 */} + + + 原图 + + + 效果 +