Initial import of weiyuan frontend
This commit is contained in:
@@ -0,0 +1,234 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
|
||||
/**
|
||||
* 玻璃卡片所需的动画与阴影样式(浮动 / 角落脉动 / aurora / 多层阴影)。
|
||||
* 内置于 GlassCard,任何使用本卡片的页面(登录、注册、企业登录…)都会自动获得,
|
||||
* 无需各自再注入一份 <style>。类名全局唯一,多处渲染重复定义亦无副作用。
|
||||
*/
|
||||
export const GlassCardStyles = () => (
|
||||
<style>{`
|
||||
@keyframes loginHaloPulse {
|
||||
0%, 100% { opacity: 0.55; transform: scale(1); }
|
||||
50% { opacity: 0.9; transform: scale(1.08); }
|
||||
}
|
||||
@keyframes loginCardFloat {
|
||||
0%, 100% { transform: translateY(0); }
|
||||
50% { transform: translateY(-4px); }
|
||||
}
|
||||
@keyframes loginAurora {
|
||||
0%, 100% { transform: translate(0%, 0%); }
|
||||
50% { transform: translate(18%, 12%); }
|
||||
}
|
||||
.login-card-float { animation: loginCardFloat 7s ease-in-out infinite; will-change: transform; }
|
||||
.login-halo-pulse { animation: loginHaloPulse 6s ease-in-out infinite; }
|
||||
.login-halo-pulse-delayed { animation: loginHaloPulse 6s ease-in-out infinite; animation-delay: 3s; }
|
||||
.login-glass-aurora {
|
||||
top: -25%;
|
||||
left: -15%;
|
||||
width: 80%;
|
||||
height: 85%;
|
||||
background: radial-gradient(ellipse at center, rgb(var(--brand-primary-rgb) / 0.16) 0%, transparent 70%);
|
||||
animation: loginAurora 22s ease-in-out infinite;
|
||||
}
|
||||
.dark .login-glass-aurora {
|
||||
background: radial-gradient(ellipse at center, rgb(var(--brand-primary-rgb) / 0.22) 0%, transparent 70%);
|
||||
}
|
||||
.login-glass-card {
|
||||
box-shadow:
|
||||
0 30px 70px -20px rgba(15, 42, 80, 0.28),
|
||||
0 12px 28px -10px rgb(var(--brand-primary-rgb) / 0.20),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.65),
|
||||
inset 0 -1px 0 rgba(255, 255, 255, 0.18);
|
||||
}
|
||||
.dark .login-glass-card {
|
||||
box-shadow:
|
||||
0 30px 70px -18px rgba(0, 0, 0, 0.65),
|
||||
0 14px 32px -10px rgb(var(--brand-primary-rgb) / 0.25),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.12),
|
||||
inset 0 -1px 0 rgba(255, 255, 255, 0.04);
|
||||
}
|
||||
/* 卡片 hover 与内部按钮 hover 联动时,避免抖动 */
|
||||
.login-glass-card:hover { box-shadow:
|
||||
0 36px 80px -18px rgba(15, 42, 80, 0.32),
|
||||
0 14px 32px -10px rgb(var(--brand-primary-rgb) / 0.26),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.7),
|
||||
inset 0 -1px 0 rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
.dark .login-glass-card:hover { box-shadow:
|
||||
0 36px 80px -16px rgba(0, 0, 0, 0.7),
|
||||
0 16px 36px -10px rgb(var(--brand-primary-rgb) / 0.3),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.14),
|
||||
inset 0 -1px 0 rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
/* 认证页 Semi 输入框玻璃风格:容器挂 .auth-glass-form 后,四个认证页
|
||||
(登录/注册/企业登录/企业注册)的输入框共享同一套观感 ——
|
||||
半透白玻璃底 + 圆角、hover 提亮、聚焦品牌色边框 + 柔和光环、错误态沿用语义色 */
|
||||
.auth-glass-form .semi-input-wrapper {
|
||||
background: rgba(255, 255, 255, 0.6);
|
||||
border: 1px solid rgba(229, 231, 235, 0.8);
|
||||
border-radius: 0.75rem;
|
||||
backdrop-filter: blur(4px);
|
||||
-webkit-backdrop-filter: blur(4px);
|
||||
transition:
|
||||
border-color 0.2s ease,
|
||||
background-color 0.2s ease,
|
||||
box-shadow 0.2s ease;
|
||||
}
|
||||
.auth-glass-form .semi-input-wrapper:hover {
|
||||
background: rgba(255, 255, 255, 0.78);
|
||||
border-color: rgba(209, 213, 219, 1);
|
||||
}
|
||||
.auth-glass-form .semi-input-wrapper-focus,
|
||||
.auth-glass-form .semi-input-wrapper-focus:hover {
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
border-color: rgb(var(--brand-primary-rgb));
|
||||
box-shadow: 0 0 0 3px rgb(var(--brand-primary-rgb) / 0.14);
|
||||
}
|
||||
.dark .auth-glass-form .semi-input-wrapper {
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
border-color: rgba(255, 255, 255, 0.12);
|
||||
}
|
||||
.dark .auth-glass-form .semi-input-wrapper:hover {
|
||||
background: rgba(255, 255, 255, 0.09);
|
||||
border-color: rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
.dark .auth-glass-form .semi-input-wrapper-focus,
|
||||
.dark .auth-glass-form .semi-input-wrapper-focus:hover {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-color: rgb(var(--brand-primary-rgb));
|
||||
box-shadow: 0 0 0 3px rgb(var(--brand-primary-rgb) / 0.22);
|
||||
}
|
||||
/* 校验失败:边框与光环改用语义 danger 色,保持玻璃底不变 */
|
||||
.auth-glass-form .semi-input-wrapper-error,
|
||||
.auth-glass-form .semi-input-wrapper-error:hover,
|
||||
.auth-glass-form .semi-input-wrapper-error.semi-input-wrapper-focus {
|
||||
border-color: var(--semi-color-danger);
|
||||
box-shadow: none;
|
||||
}
|
||||
/* 前缀图标与内建功能钮(密码眼睛/清除)默认弱化;
|
||||
只针对这三处染色,避免误染 suffix 里自定义按钮(如「获取验证码」)的 loading 图标 */
|
||||
.auth-glass-form .semi-input-wrapper .semi-input-prefix .semi-icon,
|
||||
.auth-glass-form .semi-input-wrapper .semi-input-clearbtn .semi-icon,
|
||||
.auth-glass-form .semi-input-wrapper .semi-input-modebtn .semi-icon {
|
||||
color: rgba(156, 163, 175, 1);
|
||||
transition: color 0.2s ease;
|
||||
}
|
||||
.dark .auth-glass-form .semi-input-wrapper .semi-input-prefix .semi-icon,
|
||||
.dark .auth-glass-form .semi-input-wrapper .semi-input-clearbtn .semi-icon,
|
||||
.dark .auth-glass-form .semi-input-wrapper .semi-input-modebtn .semi-icon {
|
||||
color: rgba(107, 114, 128, 1);
|
||||
}
|
||||
/* 密码眼睛/清除按钮 hover 加深,给出可点击反馈 */
|
||||
.auth-glass-form .semi-input-wrapper .semi-input-clearbtn:hover .semi-icon,
|
||||
.auth-glass-form .semi-input-wrapper .semi-input-modebtn:hover .semi-icon {
|
||||
color: rgba(75, 85, 99, 1);
|
||||
}
|
||||
.dark .auth-glass-form .semi-input-wrapper .semi-input-clearbtn:hover .semi-icon,
|
||||
.dark .auth-glass-form .semi-input-wrapper .semi-input-modebtn:hover .semi-icon {
|
||||
color: rgba(209, 213, 219, 1);
|
||||
}
|
||||
/* 聚焦时前缀图标点亮为品牌色,给出清晰的焦点反馈 */
|
||||
.auth-glass-form .semi-input-wrapper-focus .semi-input-prefix .semi-icon {
|
||||
color: rgb(var(--brand-primary-rgb));
|
||||
}
|
||||
.dark .auth-glass-form .semi-input::placeholder {
|
||||
color: rgba(255, 255, 255, 0.35);
|
||||
}
|
||||
/* 移动端降级 backdrop-filter,减轻 GPU 负担 */
|
||||
@media (max-width: 640px) {
|
||||
.login-glass-card {
|
||||
backdrop-filter: blur(24px);
|
||||
-webkit-backdrop-filter: blur(24px);
|
||||
}
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.login-card-float,
|
||||
.login-halo-pulse,
|
||||
.login-halo-pulse-delayed,
|
||||
.login-glass-aurora { animation: none; }
|
||||
.login-glass-card { transition: none; }
|
||||
}
|
||||
`}</style>
|
||||
);
|
||||
|
||||
/**
|
||||
* 登录/注册页通用的玻璃拟态卡片壳
|
||||
*
|
||||
* 视觉层(由后到前):
|
||||
* 1. 外环柔光晕(品牌渐变 + 模糊)
|
||||
* 2. 左上 / 右下角脉动光晕(可选,withCornerHalos)
|
||||
* 3. 内层 aurora(缓慢漂移的品牌色径向辉光)
|
||||
* 4. 卡片主体(高透白 + 强 backdrop-blur + ring/border 双层玻璃边)
|
||||
* 5. 顶部品牌渐变线 + 1px 白色反光(玻璃顶面反光)
|
||||
* 6. 用户传入的 children
|
||||
*
|
||||
* 交互:
|
||||
* - 整卡浮动动画(translateY,7s 缓慢呼吸)
|
||||
* - 角落光晕轻微缩放脉动(6s)
|
||||
* - 卡片 hover 微抬升(scale 1.008,500ms 缓动)
|
||||
*
|
||||
* 性能:
|
||||
* - 移动端自动降级 backdrop-filter 模糊半径(@media (max-width: 640px))
|
||||
* - aurora 单层 GPU 合成
|
||||
* - 全部动画在 prefers-reduced-motion 下关闭
|
||||
* - 阴影、aurora 颜色均使用 var(--brand-primary-rgb),跟随主题预设
|
||||
*/
|
||||
const GlassCard = ({
|
||||
children,
|
||||
withCornerHalos = true,
|
||||
withAurora = true,
|
||||
className = '',
|
||||
}) => {
|
||||
return (
|
||||
<div className={`w-full max-w-sm relative login-card-float ${className}`}>
|
||||
<GlassCardStyles />
|
||||
{/* 外环柔光晕 */}
|
||||
<div className='absolute -inset-6 bg-gradient-to-br from-brand-from/15 via-brand-via/10 to-brand-to/15 rounded-[2rem] blur-2xl opacity-80 pointer-events-none' />
|
||||
|
||||
{/* 左上 / 右下脉动光晕 */}
|
||||
{withCornerHalos && (
|
||||
<>
|
||||
<div className='absolute -top-20 -left-20 w-44 h-44 bg-brand-from/25 dark:bg-brand-from/20 rounded-full blur-3xl pointer-events-none login-halo-pulse' />
|
||||
<div className='absolute -bottom-20 -right-20 w-44 h-44 bg-brand-to/25 dark:bg-brand-to/15 rounded-full blur-3xl pointer-events-none login-halo-pulse-delayed' />
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* 卡片主体 */}
|
||||
<div className='login-glass-card relative isolate backdrop-blur-2xl bg-white/45 dark:bg-neutral-900/55 rounded-2xl ring-1 ring-white/50 dark:ring-white/[0.06] border border-white/30 dark:border-white/[0.05] px-6 py-5 overflow-hidden transition-[transform,box-shadow] duration-500 ease-out hover:scale-[1.008]'>
|
||||
{/* 内层 aurora - 缓慢漂移,z-index 负值避免遮挡内容 */}
|
||||
{withAurora && (
|
||||
<div className='login-glass-aurora absolute -z-10 pointer-events-none' />
|
||||
)}
|
||||
|
||||
{/* 顶部品牌渐变线 */}
|
||||
<div className='absolute top-0 left-0 right-0 h-0.5 bg-gradient-to-r from-brand-from via-brand-via to-brand-to opacity-90' />
|
||||
|
||||
{/* 顶部 1px 白色反光 - 紧贴品牌线下方 */}
|
||||
<div className='absolute top-0.5 left-[15%] right-[15%] h-px bg-gradient-to-r from-transparent via-white/90 dark:via-white/40 to-transparent pointer-events-none' />
|
||||
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default GlassCard;
|
||||
Reference in New Issue
Block a user