Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sdream-ai-fe
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
侯明涛
sdream-ai-fe
Commits
f79d0785
Commit
f79d0785
authored
Aug 13, 2024
by
HoMeTown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 处理navtbar button的active
parent
5bfe7047
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
src/layouts/Navbar/Navbar.tsx
+1
-1
src/layouts/Navbar/components/NavBarItem/NavBarItem.tsx
+8
-2
No files found.
src/layouts/Navbar/Navbar.tsx
View file @
f79d0785
...
...
@@ -59,7 +59,7 @@ const NavbarBase: React.FC<NavbarProps & WithAuthProps> = ({ isHistoryVisible, c
<
motion
.
div
className=
{
`${styles.layoutNavBarAgent} sm:flex hidden w-[64px] bg-white gap-[24px]`
}
>
{
NAV_BAR_ITEMS
.
map
((
item
)
=>
{
return
(
<
NavBarItem
onClick=
{
handleClick
}
icon=
{
item
.
icon
}
label=
{
item
.
label
}
key=
{
item
.
key
}
type=
{
item
.
key
}
/>
<
NavBarItem
isHistoryVisible=
{
isHistoryVisible
}
onClick=
{
handleClick
}
icon=
{
item
.
icon
}
label=
{
item
.
label
}
key=
{
item
.
key
}
type=
{
item
.
key
}
/>
)
})
}
<
User
onLogout=
{
handleLogout
}
/>
...
...
src/layouts/Navbar/components/NavBarItem/NavBarItem.tsx
View file @
f79d0785
...
...
@@ -11,8 +11,9 @@ interface NavBarItemProps {
icon
:
React
.
FunctionComponent
<
React
.
SVGProps
<
SVGSVGElement
>>
|
string
label
:
string
type
:
string
isHistoryVisible
:
boolean
}
export
const
NavBarItem
:
React
.
FC
<
NavBarItemProps
>
=
({
onClick
,
icon
,
label
,
type
})
=>
{
export
const
NavBarItem
:
React
.
FC
<
NavBarItemProps
>
=
({
isHistoryVisible
,
onClick
,
icon
,
label
,
type
})
=>
{
const
navigate
=
useNavigate
()
const
handleClickLogo
=
()
=>
{
...
...
@@ -33,11 +34,16 @@ export const NavBarItem: React.FC<NavBarItemProps> = ({ onClick, icon, label, ty
</
motion
.
div
>
)
}
const
handleActive
=
()
=>
{
return
type
===
'history'
&&
isHistoryVisible
}
return
(
<
motion
.
div
className=
{
`${styles.NavBarItem}`
}
>
<
div
className=
{
`${styles.icon}`
}
>
<
Tooltip
color=
"foreground"
content=
{
label
}
placement=
"right"
>
<
Button
onClick=
{
()
=>
onClick
(
type
)
}
variant=
"light"
isIconOnly
aria
-
label=
"Like"
>
<
Button
className=
{
handleActive
()
?
'bg-[#e4e4e5]'
:
''
}
onClick=
{
()
=>
onClick
(
type
)
}
variant=
"light"
isIconOnly
aria
-
label=
"Like"
>
{
React
.
createElement
(
icon
)
}
</
Button
>
</
Tooltip
>
...
...
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