Skip to content

Commit 839a8aa

Browse files
committed
MenubarSubmenu: wip add interface --no-verify
1 parent 6485550 commit 839a8aa

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

client/components/Menubar/MenubarSubmenu.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
} from './contexts';
1919
import TriangleIcon from '../../images/down-filled-triangle.svg';
2020

21-
export function useMenuProps(id) {
21+
export function useMenuProps(id: string) {
2222
const activeMenu = useContext(MenuOpenContext);
2323

2424
const isOpen = id === activeMenu;
@@ -73,7 +73,7 @@ const MenubarTrigger = React.forwardRef(({ role, hasPopup, ...props }, ref) => {
7373
const { id, title, first, last } = useContext(SubmenuContext);
7474
const { isOpen, handlers } = useMenuProps(id);
7575

76-
const handleMouseEnter = () => {
76+
const handleMouseEnter = (e: React.MouseEvent) => {
7777
if (hasFocus) {
7878
const items = Array.from(menuItems);
7979
const index = items.findIndex((item) => item === ref.current);
@@ -84,7 +84,7 @@ const MenubarTrigger = React.forwardRef(({ role, hasPopup, ...props }, ref) => {
8484
}
8585
};
8686

87-
const handleKeyDown = (e) => {
87+
const handleKeyDown = (e: React.KeyboardEvent) => {
8888
switch (e.key) {
8989
case 'ArrowDown':
9090
if (!isOpen) {

client/components/Menubar/contexts.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,14 @@ export interface SubmenuContextType {
4444
submenuItems: Set<RefObject<HTMLElement>>;
4545
setSubmenuActiveIndex: (index: number) => void;
4646
registerSubmenuItem: (ref: RefObject<HTMLElement>) => () => void;
47+
id: string;
48+
title: string;
4749
}
4850

4951
export const SubmenuContext = createContext<SubmenuContextType>({
5052
submenuItems: new Set(),
5153
setSubmenuActiveIndex: () => {},
52-
registerSubmenuItem: () => () => {}
54+
registerSubmenuItem: () => () => {},
55+
id: '',
56+
title: ''
5357
});

0 commit comments

Comments
 (0)