02272157
This commit is contained in:
parent
0e3c7787c4
commit
a47dc540b1
|
@ -10,7 +10,6 @@ import { useNavigate, useParams, useSearchParams } from "react-router-dom";
|
||||||
import { UserMenu } from "./UserMenu/UserMenu";
|
import { UserMenu } from "./UserMenu/UserMenu";
|
||||||
import { NavigationMenu } from "./NavigationMenu";
|
import { NavigationMenu } from "./NavigationMenu";
|
||||||
import { useMainContext } from "./MainProvider";
|
import { useMainContext } from "./MainProvider";
|
||||||
import { Header } from "antd/es/layout/layout";
|
|
||||||
|
|
||||||
export function MainHeader() {
|
export function MainHeader() {
|
||||||
const { isAuthenticated, user } = useAuth();
|
const { isAuthenticated, user } = useAuth();
|
||||||
|
@ -19,77 +18,79 @@ export function MainHeader() {
|
||||||
const { searchValue, setSearchValue } = useMainContext();
|
const { searchValue, setSearchValue } = useMainContext();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="select-none flex items-center justify-center bg-white shadow-md border-b border-gray-100 fixed w-full z-30">
|
<div className="select-none flex items-center gap-4 justify-center bg-white shadow-md border-b border-gray-100 fixed w-full z-30 h-16">
|
||||||
<div className="w-full max-w-screen-3xl px-4 md:px-6 mx-auto flex items-center justify-between h-full">
|
<div className="w-full max-w-screen-3xl px-4 md:px-6 mx-auto flex items-center justify-between h-full gap-6">
|
||||||
<div className="flex items-center space-x-8">
|
<div
|
||||||
<div
|
onClick={() => navigate("/")}
|
||||||
onClick={() => navigate("/")}
|
className="text-2xl font-bold bg-gradient-to-r from-primary-600 via-primary-500 to-primary-400 bg-clip-text text-transparent hover:scale-105 transition-transform cursor-pointer">
|
||||||
className="text-2xl font-bold bg-gradient-to-r from-primary-600 via-primary-500 to-primary-400 bg-clip-text text-transparent hover:scale-105 transition-transform cursor-pointer">
|
烽火慕课
|
||||||
烽火慕课
|
</div>
|
||||||
</div>
|
<div className="flex-1 px-6">
|
||||||
<NavigationMenu />
|
<NavigationMenu />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div className=" flex justify-end gap-4 mr-2">
|
<Input
|
||||||
<Input
|
size="large"
|
||||||
size="large"
|
prefix={
|
||||||
prefix={
|
<SearchOutlined className="text-gray-400 group-hover:text-blue-500 transition-colors" />
|
||||||
<SearchOutlined className="text-gray-400 group-hover:text-blue-500 transition-colors" />
|
}
|
||||||
|
placeholder="搜索课程"
|
||||||
|
className="w-96 rounded-full"
|
||||||
|
value={searchValue}
|
||||||
|
onChange={(e) => setSearchValue(e.target.value)}
|
||||||
|
onPressEnter={(e) => {
|
||||||
|
if (
|
||||||
|
!window.location.pathname.startsWith("/courses/") &&
|
||||||
|
!window.location.pathname.startsWith("my")
|
||||||
|
) {
|
||||||
|
navigate(`/courses/`);
|
||||||
|
window.scrollTo({
|
||||||
|
top: 0,
|
||||||
|
behavior: "smooth",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
placeholder="搜索课程"
|
}}
|
||||||
className="w-96 rounded-full"
|
/>
|
||||||
value={searchValue}
|
<div className="flex items-center gap-4">
|
||||||
onChange={(e) => setSearchValue(e.target.value)}
|
{isAuthenticated && (
|
||||||
onPressEnter={(e) => {
|
<>
|
||||||
if (
|
|
||||||
!window.location.pathname.startsWith("/courses/") &&
|
|
||||||
!window.location.pathname.startsWith("my")
|
|
||||||
) {
|
|
||||||
navigate(`/courses/`);
|
|
||||||
window.scrollTo({
|
|
||||||
top: 0,
|
|
||||||
behavior: "smooth",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<div className="flex items-center gap-4">
|
|
||||||
{isAuthenticated && (
|
|
||||||
<>
|
|
||||||
<Button
|
|
||||||
onClick={() => {
|
|
||||||
const url = id
|
|
||||||
? `/course/${id}/editor`
|
|
||||||
: "/course/editor";
|
|
||||||
navigate(url);
|
|
||||||
}}
|
|
||||||
className="flex items-center space-x-1 bg-gradient-to-r from-blue-500 to-blue-600 text-white hover:from-blue-600 hover:to-blue-700 border-none shadow-md hover:shadow-lg transition-all"
|
|
||||||
icon={<EditFilled />}>
|
|
||||||
{id ? "编辑课程" : "创建课程"}
|
|
||||||
</Button>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{isAuthenticated && (
|
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
window.location.href = "/path/editor";
|
const url = id
|
||||||
|
? `/course/${id}/editor`
|
||||||
|
: "/course/editor";
|
||||||
|
navigate(url);
|
||||||
}}
|
}}
|
||||||
icon={<PlusOutlined></PlusOutlined>}>
|
type="primary"
|
||||||
创建学习路径
|
icon={<EditFilled />}>
|
||||||
|
{id ? "编辑课程" : "创建课程"}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
</>
|
||||||
{isAuthenticated ? (
|
)}
|
||||||
<UserMenu />
|
{isAuthenticated && (
|
||||||
) : (
|
<Button
|
||||||
<Button
|
type="primary"
|
||||||
onClick={() => navigate("/login")}
|
ghost
|
||||||
className="flex items-center space-x-1 bg-gradient-to-r from-blue-500 to-blue-600 text-white hover:from-blue-600 hover:to-blue-700 border-none shadow-md hover:shadow-lg transition-all"
|
onClick={() => {
|
||||||
icon={<UserOutlined />}>
|
window.location.href = "/path/editor";
|
||||||
登录
|
}}
|
||||||
</Button>
|
icon={<PlusOutlined></PlusOutlined>}>
|
||||||
)}
|
创建学习路径
|
||||||
</div>
|
</Button>
|
||||||
|
)}
|
||||||
|
{isAuthenticated ? (
|
||||||
|
<UserMenu />
|
||||||
|
) : (
|
||||||
|
<Button
|
||||||
|
onClick={() => navigate("/login")}
|
||||||
|
className="flex items-center space-x-1 bg-gradient-to-r from-blue-500 to-blue-600 text-white hover:from-blue-600 hover:to-blue-700 border-none shadow-md hover:shadow-lg transition-all"
|
||||||
|
icon={<UserOutlined />}>
|
||||||
|
登录
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,7 +161,3 @@
|
||||||
/* 去除最后一行的底部边框 */
|
/* 去除最后一行的底部边框 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.mind-editor {
|
|
||||||
height: calc(100vh - 285px);
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
Loading…
Reference in New Issue