Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
love_飞影
Neos
Commits
df7a8c3b
Commit
df7a8c3b
authored
Aug 09, 2023
by
timel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: nav link2
parent
7520d5f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
12 deletions
+31
-12
src/ui/Layout/index.module.scss
src/ui/Layout/index.module.scss
+5
-1
src/ui/Layout/index.tsx
src/ui/Layout/index.tsx
+26
-11
No files found.
src/ui/Layout/index.module.scss
View file @
df7a8c3b
...
...
@@ -32,12 +32,16 @@
font-size
:
0
.825rem
;
line-height
:
var
(
--
header-height
);
transition
:
0
.3s
;
&
:hover
{
&
:
not
(
.disabled
)
:
hover
{
box-shadow
:
0px
2px
0
0
white
inset
;
}
&
:global
(
.active
)
{
box-shadow
:
0px
2px
0
0
white
inset
;
}
&
.disabled
{
color
:
hsl
(
0
,
0%
,
50%
);
cursor
:
not
-
allowed
;
}
}
}
...
...
src/ui/Layout/index.tsx
View file @
df7a8c3b
import
{
Avatar
}
from
"
antd
"
;
import
{
useEffect
}
from
"
react
"
;
import
React
,
{
useEffect
}
from
"
react
"
;
import
{
type
LoaderFunction
,
NavLink
,
...
...
@@ -19,6 +19,7 @@ import {
initSqlite
,
initWASM
,
}
from
"
./utils
"
;
import
classNames
from
"
classnames
"
;
const
NeosConfig
=
useConfig
();
...
...
@@ -30,6 +31,20 @@ export const loader: LoaderFunction = async () => {
return
null
;
};
const
HeaderBtn
:
React
.
FC
<
React
.
PropsWithChildren
<
{
to
:
string
;
disabled
?:
boolean
}
>
>
=
({
to
,
children
,
disabled
=
false
})
=>
{
const
Element
=
disabled
?
"
div
"
:
NavLink
;
return
(
<
Element
to=
{
disabled
?
"
/
"
:
to
}
className=
{
classNames
(
styles
.
link
,
{
[
styles
.
disabled
]:
disabled
})
}
>
{
children
}
</
Element
>
);
};
export
const
Component
=
()
=>
{
// 捕获SSO登录
const
location
=
useLocation
();
...
...
@@ -37,7 +52,9 @@ export const Component = () => {
location
.
search
&&
handleSSOLogin
(
location
.
search
);
},
[
location
.
search
]);
// TODO 根据是否登录,显示内容
// 根据是否登录,显示内容
const
logined
=
Boolean
(
useSnapshot
(
accountStore
).
user
);
const
{
pathname
}
=
useLocation
();
const
pathnamesHideHeader
=
[
"
/waitroom
"
];
return
(
...
...
@@ -56,21 +73,19 @@ export const Component = () => {
/>
</
a
>
<
NavLink
to=
"/"
className=
{
styles
.
link
}
>
主页
</
NavLink
>
<
NavLink
to=
"/match"
className=
{
styles
.
link
}
>
<
HeaderBtn
to=
"/"
>
主页
</
HeaderBtn
>
<
HeaderBtn
to=
"/match"
disabled=
{
!
logined
}
>
匹配
</
NavLink
>
<
NavLink
to=
"/build"
className=
{
styles
.
link
}
>
</
HeaderBtn
>
<
HeaderBtn
to=
"/build"
disabled=
{
!
logined
}
>
组卡
</
NavLink
>
</
HeaderBtn
>
<
span
style=
{
{
flexGrow
:
1
}
}
/>
<
span
className=
{
styles
.
profile
}
>
<
NeosAvatar
/>
<
NavLink
to=
"/profile"
className=
{
styles
.
link
}
>
<
HeaderBtn
to=
"/profile"
disabled=
{
!
logined
}
>
个人中心
</
NavLink
>
</
HeaderBtn
>
</
span
>
</
nav
>
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment