Initial import of weiyuan frontend
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
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';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
/**
|
||||
* 认证页「个人 / 企业」分段切换控件(登录与注册两种模式)。
|
||||
* 跨页跳转:mode='login' 在 /login 与 /org/login 间切换;
|
||||
* mode='register' 在 /register 与 /org/register 间切换。四页共用,保持对称的信息架构。
|
||||
* active:当前页归属('personal' | 'enterprise'),高亮且不重复跳转。
|
||||
*
|
||||
* 浮于玻璃卡片之外、之上:自带玻璃壳(backdrop-blur + 半透白底 + ring/border),
|
||||
* 在背景上保持可读并与下方卡片呼应;激活态用品牌渐变强化「当前入口」的辨识度。
|
||||
*/
|
||||
const AuthLoginTabs = ({ active = 'personal', mode = 'login' }) => {
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
|
||||
// 企业入口置于左侧首位:本产品主推企业用户,企业登录/注册是默认入口
|
||||
const tabs =
|
||||
mode === 'register'
|
||||
? [
|
||||
{ key: 'enterprise', label: t('企业注册'), to: '/org/register' },
|
||||
{ key: 'personal', label: t('个人注册'), to: '/register' },
|
||||
]
|
||||
: [
|
||||
{ key: 'enterprise', label: t('企业登录'), to: '/org/login' },
|
||||
{ key: 'personal', label: t('个人登录'), to: '/login' },
|
||||
];
|
||||
|
||||
return (
|
||||
<div className='relative z-20 flex p-1 gap-1 rounded-2xl backdrop-blur-2xl bg-white/45 dark:bg-neutral-900/55 ring-1 ring-white/50 dark:ring-white/[0.06] border border-white/30 dark:border-white/[0.05] shadow-[0_12px_32px_-16px_rgb(var(--brand-primary-rgb)/0.45)]'>
|
||||
{tabs.map((tab) => {
|
||||
const isActive = tab.key === active;
|
||||
return (
|
||||
<button
|
||||
key={tab.key}
|
||||
type='button'
|
||||
aria-pressed={isActive}
|
||||
onClick={() => {
|
||||
if (!isActive) navigate(tab.to);
|
||||
}}
|
||||
className={`flex-1 h-10 rounded-xl text-sm font-medium transition-all duration-200 ${
|
||||
isActive
|
||||
? 'bg-gradient-to-r from-brand-from to-brand-to text-white shadow-md shadow-brand/25'
|
||||
: 'text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 hover:bg-white/40 dark:hover:bg-white/[0.05]'
|
||||
}`}
|
||||
>
|
||||
{tab.label}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default AuthLoginTabs;
|
||||
Reference in New Issue
Block a user