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
78833d53
Commit
78833d53
authored
6 months ago
by
Yifeng Wang
Browse files
Options
Downloads
Patches
Plain Diff
add progress of home
parent
642093f1
No related branches found
No related tags found
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/Navbar.css
+13
-2
13 additions, 2 deletions
src/components/Navbar.css
src/components/Navbar.tsx
+32
-2
32 additions, 2 deletions
src/components/Navbar.tsx
src/contents/model copy.tsx
+1068
-0
1068 additions, 0 deletions
src/contents/model copy.tsx
with
1113 additions
and
4 deletions
src/components/Navbar.css
+
13
−
2
View file @
78833d53
...
@@ -43,6 +43,7 @@
...
@@ -43,6 +43,7 @@
.apple-nav
{
.apple-nav
{
font-family
:
'pangolin'
,
cursive
;
font-family
:
'pangolin'
,
cursive
;
margin-right
:
auto
;
margin-right
:
auto
;
z-index
:
999
;
}
}
.apple-nav
.nav-link
,
.apple-nav
.nav-link
,
...
@@ -55,13 +56,23 @@
...
@@ -55,13 +56,23 @@
padding
:
12px
20px
;
padding
:
12px
20px
;
transition
:
opacity
0.2s
ease
;
transition
:
opacity
0.2s
ease
;
}
}
.scroll-progress-bar
{
width
:
var
(
--scroll-progress
);
}
.apple-nav
.nav-link
:hover
,
.apple-nav
.nav-link
:hover
,
.apple-nav
.dropdown-toggle
:hover
{
.apple-nav
.dropdown-toggle
:hover
{
opacity
:
0.65
;
opacity
:
0.65
;
}
}
.scroll-progress-bar
{
position
:
fixed
;
top
:
68px
;
/* 调整这个值以匹配你的导航栏高度 */
left
:
0
;
height
:
3px
;
background-color
:
#007aff
;
/* 使用 Apple 风格的蓝色 */
z-index
:
1000
;
transition
:
width
0.1s
ease-out
;
}
.apple-nav
.dropdown-menu
{
.apple-nav
.dropdown-menu
{
background-color
:
rgba
(
255
,
255
,
255
,
0.8
);
background-color
:
rgba
(
255
,
255
,
255
,
0.8
);
backdrop-filter
:
saturate
(
180%
)
blur
(
20px
);
backdrop-filter
:
saturate
(
180%
)
blur
(
20px
);
...
...
This diff is collapsed.
Click to expand it.
src/components/Navbar.tsx
+
32
−
2
View file @
78833d53
import
React
,
{
useState
,
useEffect
}
from
"
react
"
;
import
Nav
from
"
react-bootstrap/Nav
"
;
import
Nav
from
"
react-bootstrap/Nav
"
;
import
BootstrapNavbar
from
"
react-bootstrap/Navbar
"
;
import
BootstrapNavbar
from
"
react-bootstrap/Navbar
"
;
import
NavDropdown
from
"
react-bootstrap/NavDropdown
"
;
import
NavDropdown
from
"
react-bootstrap/NavDropdown
"
;
import
{
Link
}
from
"
react-router-dom
"
;
import
{
Link
,
useLocation
}
from
"
react-router-dom
"
;
import
Pages
from
"
../pages.ts
"
;
import
Pages
from
"
../pages.ts
"
;
import
{
Container
}
from
"
react-bootstrap
"
;
import
{
Container
}
from
"
react-bootstrap
"
;
import
"
./Navbar.css
"
;
// 添加这行来引入自定义 CSS 文件的1
import
"
./Navbar.css
"
;
export
function
Navbar
()
{
export
function
Navbar
()
{
const
[
scrollProgress
,
setScrollProgress
]
=
useState
(
0
);
const
location
=
useLocation
();
useEffect
(()
=>
{
const
handleScroll
=
()
=>
{
const
totalScroll
=
document
.
documentElement
.
scrollHeight
-
window
.
innerHeight
;
const
currentScroll
=
window
.
pageYOffset
;
const
scrollPercentage
=
(
currentScroll
/
totalScroll
)
*
100
;
setScrollProgress
(
scrollPercentage
);
};
if
(
location
.
pathname
===
"
/
"
)
{
window
.
addEventListener
(
"
scroll
"
,
handleScroll
);
handleScroll
();
// 初始化进度
}
return
()
=>
{
window
.
removeEventListener
(
"
scroll
"
,
handleScroll
);
};
},
[
location
]);
const
pages
=
Pages
.
map
((
item
,
pageIndex
)
=>
{
const
pages
=
Pages
.
map
((
item
,
pageIndex
)
=>
{
if
(
"
folder
"
in
item
&&
item
.
folder
)
{
if
(
"
folder
"
in
item
&&
item
.
folder
)
{
const
folderItems
=
item
.
folder
.
map
((
subpage
,
subpageIndex
)
=>
{
const
folderItems
=
item
.
folder
.
map
((
subpage
,
subpageIndex
)
=>
{
...
@@ -49,6 +70,8 @@ export function Navbar() {
...
@@ -49,6 +70,8 @@ export function Navbar() {
});
});
return
(
return
(
<>
<
BootstrapNavbar
expand
=
"lg"
className
=
"apple-navbar"
fixed
=
"top"
>
<
BootstrapNavbar
expand
=
"lg"
className
=
"apple-navbar"
fixed
=
"top"
>
<
Container
fluid
>
<
Container
fluid
>
<
Link
to
=
"/"
className
=
"apple-brand"
>
<
Link
to
=
"/"
className
=
"apple-brand"
>
...
@@ -60,5 +83,12 @@ export function Navbar() {
...
@@ -60,5 +83,12 @@ export function Navbar() {
</
BootstrapNavbar
.
Collapse
>
</
BootstrapNavbar
.
Collapse
>
</
Container
>
</
Container
>
</
BootstrapNavbar
>
</
BootstrapNavbar
>
{
location
.
pathname
===
"
/
"
&&
(
<
div
className
=
"scroll-progress-bar"
style
=
{
{
width
:
`
${
scrollProgress
}
%`
}
}
></
div
>
)
}
</>
);
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/contents/model copy.tsx
0 → 100644
+
1068
−
0
View file @
78833d53
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