Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SMU-GDMU-CHINA
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
2024 Competition
SMU-GDMU-CHINA
Commits
e65e886c
Commit
e65e886c
authored
6 months ago
by
Yifeng Wang
Browse files
Options
Downloads
Patches
Plain Diff
reset the navbar
parent
149c07f6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#442824
failed
6 months ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/Navbar copy 2.tsx
+100
-0
100 additions, 0 deletions
src/components/Navbar copy 2.tsx
src/components/Navbar.tsx
+20
-58
20 additions, 58 deletions
src/components/Navbar.tsx
with
120 additions
and
58 deletions
src/components/Navbar copy 2.tsx
0 → 100644
+
100
−
0
View file @
e65e886c
// 导入图标
import
Nav
from
"
react-bootstrap/Nav
"
;
import
BootstrapNavbar
from
"
react-bootstrap/Navbar
"
;
import
NavDropdown
from
"
react-bootstrap/NavDropdown
"
;
import
{
Link
}
from
"
react-router-dom
"
;
import
Pages
from
"
../pages.ts
"
;
import
{
Container
}
from
"
react-bootstrap
"
;
import
"
./Navbar.css
"
;
// 导入更多图标
import
{
FaHome
,
FaFolder
,
FaInfo
,
FaFlask
,
FaUsers
,
FaCog
,
FaBook
,
FaTrophy
,
FaLightbulb
,
FaChartBar
}
from
"
react-icons/fa
"
;
// 创建一个图标映射对象
const
iconMap
=
{
Home
:
FaHome
,
About
:
FaInfo
,
Team
:
FaUsers
,
Project
:
FaFlask
,
Parts
:
FaCog
,
Lab
:
FaBook
,
Human
:
FaUsers
,
Model
:
FaChartBar
,
Results
:
FaTrophy
,
Implementation
:
FaLightbulb
,
// 添加更多映射...
};
export
function
Navbar
()
{
const
pages
=
Pages
.
map
((
item
,
pageIndex
)
=>
{
if
(
"
folder
"
in
item
&&
item
.
folder
)
{
const
folderItems
=
item
.
folder
.
map
((
subpage
,
subpageIndex
)
=>
{
if
(
subpage
.
path
)
{
const
SubIcon
=
iconMap
[
subpage
.
name
]
||
FaFolder
;
return
(
<
NavDropdown
.
Item
key
=
{
`subpage-
${
pageIndex
}
-
${
subpageIndex
}
`
}
as
=
{
Link
}
to
=
{
subpage
.
path
}
className
=
"custom-dropdown-menu"
>
<
SubIcon
className
=
"nav-icon"
/>
{
subpage
.
name
}
</
NavDropdown
.
Item
>
);
}
});
return
(
<
NavDropdown
key
=
{
`page-
${
pageIndex
}
`
}
title
=
{
<>
<
FaFolder
className
=
"nav-icon"
/>
{
item
.
name
}
</>
}
id
=
"basic-nav-dropdown"
className
=
"custom-dropdown-menu"
>
{
folderItems
}
</
NavDropdown
>
);
}
else
if
(
"
path
"
in
item
&&
item
.
path
)
{
const
Icon
=
iconMap
[
item
.
name
]
||
FaFolder
;
return
(
<
Nav
.
Link
key
=
{
`page-
${
pageIndex
}
`
}
as
=
{
Link
}
to
=
{
item
.
path
}
className
=
"custom-dropdown-menu"
>
<
Icon
className
=
"nav-icon"
/>
{
item
.
name
}
</
Nav
.
Link
>
);
}
});
return
(
<
BootstrapNavbar
expand
=
"lg"
className
=
"apple-navbar"
fixed
=
"top"
>
<
Container
fluid
>
<
BootstrapNavbar
.
Brand
as
=
{
Link
}
to
=
"/"
className
=
"apple-brand"
>
<
img
src
=
"https://static.igem.wiki/teams/5378/lesser-panda/logo.webp"
className
=
"apple-logo"
alt
=
"Logo"
/>
</
BootstrapNavbar
.
Brand
>
<
BootstrapNavbar
.
Toggle
aria-controls
=
"basic-navbar-nav"
className
=
"apple-toggler"
/>
<
BootstrapNavbar
.
Collapse
id
=
"basic-navbar-nav"
>
<
Nav
className
=
"ms-auto apple-nav"
>
{
pages
}
</
Nav
>
</
BootstrapNavbar
.
Collapse
>
</
Container
>
</
BootstrapNavbar
>
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/components/Navbar.tsx
+
20
−
58
View file @
e65e886c
// 导入图标
import
Nav
from
"
react-bootstrap/Nav
"
;
import
BootstrapNavbar
from
"
react-bootstrap/Navbar
"
;
import
NavDropdown
from
"
react-bootstrap/NavDropdown
"
;
import
{
Link
}
from
"
react-router-dom
"
;
import
Pages
from
"
../pages.ts
"
;
import
{
Container
}
from
"
react-bootstrap
"
;
import
"
./Navbar.css
"
;
// 导入更多图标
import
{
FaHome
,
FaFolder
,
FaInfo
,
FaFlask
,
FaUsers
,
FaCog
,
FaBook
,
FaTrophy
,
FaLightbulb
,
FaChartBar
}
from
"
react-icons/fa
"
;
// 创建一个图标映射对象
const
iconMap
=
{
Home
:
FaHome
,
About
:
FaInfo
,
Team
:
FaUsers
,
Project
:
FaFlask
,
Parts
:
FaCog
,
Lab
:
FaBook
,
Human
:
FaUsers
,
Model
:
FaChartBar
,
Results
:
FaTrophy
,
Implementation
:
FaLightbulb
,
// 添加更多映射...
};
import
"
./Navbar.css
"
;
// 添加这行来引入自定义 CSS 文件的
export
function
Navbar
()
{
const
pages
=
Pages
.
map
((
item
,
pageIndex
)
=>
{
if
(
"
folder
"
in
item
&&
item
.
folder
)
{
const
folderItems
=
item
.
folder
.
map
((
subpage
,
subpageIndex
)
=>
{
if
(
subpage
.
path
)
{
const
SubIcon
=
iconMap
[
subpage
.
name
]
||
FaFolder
;
return
(
<
NavDropdown
.
Item
key
=
{
`subpage-
${
pageIndex
}
-
${
subpageIndex
}
`
}
...
...
@@ -48,7 +19,7 @@ export function Navbar() {
to
=
{
subpage
.
path
}
className
=
"custom-dropdown-menu"
>
<
SubIcon
className
=
"nav-icon"
/>
{
subpage
.
name
}
{
subpage
.
name
}
</
NavDropdown
.
Item
>
);
}
...
...
@@ -56,11 +27,7 @@ export function Navbar() {
return
(
<
NavDropdown
key
=
{
`page-
${
pageIndex
}
`
}
title
=
{
<>
<
FaFolder
className
=
"nav-icon"
/>
{
item
.
name
}
</>
}
title
=
{
item
.
name
}
id
=
"basic-nav-dropdown"
className
=
"custom-dropdown-menu"
>
...
...
@@ -68,33 +35,28 @@ export function Navbar() {
</
NavDropdown
>
);
}
else
if
(
"
path
"
in
item
&&
item
.
path
)
{
const
Icon
=
iconMap
[
item
.
name
]
||
FaFolder
;
return
(
<
Nav
.
Link
key
=
{
`page-
${
pageIndex
}
`
}
as
=
{
Link
}
to
=
{
item
.
path
}
className
=
"custom-dropdown-menu"
key
=
{
`page-
${
pageIndex
}
`
}
as
=
{
Link
}
to
=
{
item
.
path
}
className
=
"custom-dropdown-menu"
>
<
Icon
className
=
"nav-icon"
/>
{
item
.
name
}
{
item
.
name
}
</
Nav
.
Link
>
);
}
});
return
(
<
BootstrapNavbar
expand
=
"lg"
className
=
"apple-navbar"
fixed
=
"top"
>
<
Container
fluid
>
<
BootstrapNavbar
.
Brand
as
=
{
Link
}
to
=
"/"
className
=
"apple-brand"
>
<
img
src
=
"https://static.igem.wiki/teams/5378/lesser-panda/logo.webp"
className
=
"apple-logo"
alt
=
"Logo"
/>
</
BootstrapNavbar
.
Brand
>
<
BootstrapNavbar
.
Toggle
aria-controls
=
"basic-navbar-nav"
className
=
"apple-toggler"
/>
<
BootstrapNavbar
.
Collapse
id
=
"basic-navbar-nav"
>
<
Nav
className
=
"ms-auto apple-nav"
>
{
pages
}
</
Nav
>
</
BootstrapNavbar
.
Collapse
>
</
Container
>
</
BootstrapNavbar
>
);
return
(
<
BootstrapNavbar
expand
=
"lg"
className
=
"apple-navbar"
fixed
=
"top"
>
<
Container
fluid
>
<
BootstrapNavbar
.
Brand
as
=
{
Link
}
to
=
"/"
className
=
"apple-brand"
>
<
img
src
=
"https://static.igem.wiki/teams/5378/lesser-panda/logo.webp"
className
=
"apple-logo"
alt
=
"Logo"
/>
</
BootstrapNavbar
.
Brand
>
<
BootstrapNavbar
.
Toggle
aria-controls
=
"basic-navbar-nav"
className
=
"apple-toggler"
/>
<
BootstrapNavbar
.
Collapse
id
=
"basic-navbar-nav"
>
<
Nav
className
=
"ms-auto apple-nav"
>
{
pages
}
</
Nav
>
</
BootstrapNavbar
.
Collapse
>
</
Container
>
</
BootstrapNavbar
>
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment