feat: 参考原型图 ui优化提交 个人端-用户中心 相关的页面
This commit is contained in:
@@ -18,10 +18,10 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Button, Dropdown } from '@douyinfe/semi-ui';
|
||||
import { Button as AntButton } from 'antd';
|
||||
import { Dropdown } from '@/components/ui';
|
||||
import { Globe } from 'lucide-react';
|
||||
import { CN, GB, JP, KR, TH, VN } from 'country-flag-icons/react/3x2';
|
||||
import { useActualTheme } from '../../../context/Theme';
|
||||
import { normalizeLanguage } from '../../../i18n/language';
|
||||
import { orderEnabledLanguages } from '../../../i18n/catalog';
|
||||
import {
|
||||
@@ -36,10 +36,6 @@ const LanguageSelector = ({ currentLang, onLanguageChange, t }) => {
|
||||
// i18n.language 可能带地区码(如 zh-CN / en-US),高亮判断先归一化;
|
||||
// 繁体靠地区码区分,不能简单取主语言
|
||||
const lang = normalizeLanguage(currentLang);
|
||||
// 与 ThemeToggle 同规范:图标颜色随实际主题动态取色(Semi 暗色由
|
||||
// body[theme-mode] 驱动,Tailwind dark: 类在此不可靠),菜单样式走
|
||||
// semi-color token 天然亮暗自适应
|
||||
const actualTheme = useActualTheme();
|
||||
|
||||
// 首访时后台判定可能晚于顶栏首次渲染:结果写入缓存后重新读取启用语言,
|
||||
// 避免列出后台已停用的语言
|
||||
@@ -54,8 +50,8 @@ const LanguageSelector = ({ currentLang, onLanguageChange, t }) => {
|
||||
const getItemClassName = (isSelected) =>
|
||||
`!flex !items-center !gap-2 !px-3 !py-1.5 !text-sm ${
|
||||
isSelected
|
||||
? '!bg-semi-color-primary-light-default !font-semibold'
|
||||
: 'hover:!bg-semi-color-fill-1'
|
||||
? '!bg-ui-color-primary-light-default !font-semibold'
|
||||
: 'hover:!bg-ui-color-fill-1'
|
||||
}`;
|
||||
|
||||
// 展示哪些语言、按什么顺序由后台「语言与地区」配置决定(经 /api/i18n/locale 缓存下发)
|
||||
@@ -82,21 +78,12 @@ const LanguageSelector = ({ currentLang, onLanguageChange, t }) => {
|
||||
</Dropdown.Menu>
|
||||
}
|
||||
>
|
||||
<span className='inline-flex'>
|
||||
<Button
|
||||
icon={<Globe size={20} />}
|
||||
aria-label={t('common.changeLanguage')}
|
||||
theme='borderless'
|
||||
type='tertiary'
|
||||
className='!w-8 !h-8 sm:!w-9 sm:!h-9 !flex !items-center !justify-center hover:!bg-brand/10 dark:hover:!bg-brand/15 hover:!text-brand-deep dark:hover:!text-brand-from !rounded-full !transition-all !duration-200 hover:!scale-[1.08] active:!scale-95'
|
||||
style={{
|
||||
color:
|
||||
actualTheme === 'dark'
|
||||
? 'rgba(243,244,246,0.9)'
|
||||
: 'rgba(75,85,99,1)',
|
||||
}}
|
||||
/>
|
||||
</span>
|
||||
<AntButton
|
||||
type='text'
|
||||
icon={<Globe size={16} strokeWidth={1.5} aria-hidden />}
|
||||
aria-label={t('common.changeLanguage')}
|
||||
className='ui-header-icon-action'
|
||||
/>
|
||||
</Dropdown>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user