75 lines
2.8 KiB
React
75 lines
2.8 KiB
React
/*
|
|
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 { useTranslation } from 'react-i18next';
|
|
import React from 'react';
|
|
import { Sparkles } from 'lucide-react';
|
|
|
|
/**
|
|
* 登录/注册/企业登录页卡片顶部的「品牌 Logo + 标题 + 副标题」头部。
|
|
*
|
|
* 这一段(Logo 光环 + 白底圆角 + 右上角 Sparkles + h4 标题 + p 副标题)原本在
|
|
* LoginForm / RegisterForm / OrgLogin 中重复了 5 份,抽到这里统一维护,避免日后样式漂移。
|
|
*
|
|
* - logoNode:自定义 Logo 节点(如企业 Avatar);不传则用 logo(src) 渲染平台 <img>。
|
|
* - wrapperClassName / logoWrapperClassName:保留各页面原有的间距微调(mb-*)。
|
|
* - Sparkles 统一用 motion-safe:animate-pulse,遵循 prefers-reduced-motion。
|
|
*/
|
|
const AuthCardHeader = ({
|
|
title,
|
|
subtitle,
|
|
logo,
|
|
logoNode,
|
|
wrapperClassName = 'mb-5',
|
|
logoWrapperClassName = 'mb-3',
|
|
}) => {
|
|
const { t } = useTranslation();
|
|
return (
|
|
<div
|
|
className={`auth-card-header flex flex-col items-center justify-center ${wrapperClassName}`}
|
|
>
|
|
<div className={`auth-card-logo relative ${logoWrapperClassName}`}>
|
|
{/* Logo 光环(.auth-login-page 认证页内隐藏,保持克制) */}
|
|
<div className='auth-card-logo-halo absolute -inset-1.5 bg-gradient-to-r from-brand-from/30 to-brand-to/30 rounded-xl blur-md opacity-60' />
|
|
<div className='auth-card-logo-box relative p-2 bg-white dark:bg-neutral-800 rounded-xl shadow-md'>
|
|
{logoNode || (
|
|
<img
|
|
src={logo}
|
|
alt={t('网站标志')}
|
|
className='h-10 w-10 rounded-lg object-cover'
|
|
/>
|
|
)}
|
|
</div>
|
|
<Sparkles
|
|
size={14}
|
|
className='auth-card-sparkle absolute -top-0.5 -right-0.5 text-amber-400 motion-safe:animate-pulse'
|
|
/>
|
|
</div>
|
|
<h4 className='auth-card-title text-xl font-bold text-gray-800 dark:text-white tracking-tight mb-0.5'>
|
|
{title}
|
|
</h4>
|
|
<p className='auth-card-subtitle text-gray-500 dark:text-gray-400 text-xs'>
|
|
{subtitle}
|
|
</p>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default AuthCardHeader;
|