mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-09-05 23:57:19 +08:00
feat(Header, Sidebar): enhance mobile responsiveness by conditionally rendering components
This commit is contained in:
@@ -16,6 +16,7 @@ import { type RouteConfig } from '../../routes';
|
|||||||
import UserAvatar from '../../components/UserAvatar';
|
import UserAvatar from '../../components/UserAvatar';
|
||||||
import { UserRole } from '../../api/types';
|
import { UserRole } from '../../api/types';
|
||||||
import SearchDialog from '../../components/search/SearchDialog';
|
import SearchDialog from '../../components/search/SearchDialog';
|
||||||
|
import useIsMobile from '../../hooks/useIsMobile';
|
||||||
|
|
||||||
const { Header: AntHeader } = Layout;
|
const { Header: AntHeader } = Layout;
|
||||||
interface HeaderProps {
|
interface HeaderProps {
|
||||||
@@ -48,6 +49,7 @@ const Header: React.FC<HeaderProps> = ({
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const headerRef = useRef<HTMLDivElement>(null);
|
const headerRef = useRef<HTMLDivElement>(null);
|
||||||
const { hasRole } = useAuth();
|
const { hasRole } = useAuth();
|
||||||
|
const isMobileDevice = useIsMobile();
|
||||||
|
|
||||||
// 添加搜索对话框状态
|
// 添加搜索对话框状态
|
||||||
const [searchDialogVisible, setSearchDialogVisible] = useState(false);
|
const [searchDialogVisible, setSearchDialogVisible] = useState(false);
|
||||||
@@ -236,7 +238,7 @@ const Header: React.FC<HeaderProps> = ({
|
|||||||
marginRight: 12
|
marginRight: 12
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{renderBreadcrumb()}
|
{!isMobileDevice && renderBreadcrumb()}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 右侧区域:搜索框和用户菜单 */}
|
{/* 右侧区域:搜索框和用户菜单 */}
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ const Sidebar: React.FC<SidebarProps> = ({ collapsed, isMobile = false, onClose,
|
|||||||
if (area === 'admin') {
|
if (area === 'admin') {
|
||||||
return {
|
return {
|
||||||
logo: logo,
|
logo: logo,
|
||||||
title: 'Foxel 管理后台'
|
title: 'Foxel 面板'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user