Skip to content

Commit

Permalink
fix(navbar): onchange issue
Browse files Browse the repository at this point in the history
style: version update
  • Loading branch information
MaxtuneLee committed Aug 24, 2024
1 parent a29e104 commit d7de4bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions packages/ui-react/lib/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ export const Navbar = React.forwardRef<HTMLDivElement, NavbarProps>(

useEffect(() => {
itemMoveAnimation();
onchange && onchange(selectItem);
}, [selectItem, onchange]);
}, [selectItem]);

const itemMoveAnimation = () => {
const currentEle = selectedItemRef.current as HTMLDivElement;
Expand Down Expand Up @@ -115,7 +114,10 @@ export const Navbar = React.forwardRef<HTMLDivElement, NavbarProps>(
className={`${styles['navbar-item']} ${selectItem === item.itemKey ? styles['select'] : ''}`}
id={item.itemKey}
ref={selectItem === item.itemKey ? selectedItemRef : undefined}
onClick={() => setSelectItem(item.itemKey)}
onClick={() => {
setSelectItem(item.itemKey);
onchange && onchange(item.itemKey);
}}
>
{item.icon}
<span>{item.text}</span>
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ui-aurora/react",
"version": "0.0.14",
"version": "0.0.16",
"description": "A React UI library built for SASTOJ",
"author": "sast",
"license": "MIT",
Expand Down

0 comments on commit d7de4bc

Please sign in to comment.