mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
feat(web): add ability to not be able to close menu
This commit is contained in:
@@ -43,6 +43,7 @@ function lib.showMenu(id)
|
||||
action = 'setMenu',
|
||||
data = {
|
||||
position = menu.position,
|
||||
canClose = menu.canClose,
|
||||
title = menu.title,
|
||||
items = menu.options
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ export interface MenuItem {
|
||||
export interface MenuSettings {
|
||||
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
||||
title: string;
|
||||
canClose?: boolean;
|
||||
items: Array<MenuItem>;
|
||||
}
|
||||
|
||||
@@ -36,6 +37,7 @@ const ListMenu: React.FC = () => {
|
||||
const listRefs = useRef<Array<HTMLDivElement | null>>([]);
|
||||
|
||||
const closeMenu = (ignoreFetch?: boolean) => {
|
||||
if (menu.canClose === false) return;
|
||||
setVisible(false);
|
||||
if (!ignoreFetch) fetchNui('closeMenu');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user