mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-19 07:56:02 +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',
|
action = 'setMenu',
|
||||||
data = {
|
data = {
|
||||||
position = menu.position,
|
position = menu.position,
|
||||||
|
canClose = menu.canClose,
|
||||||
title = menu.title,
|
title = menu.title,
|
||||||
items = menu.options
|
items = menu.options
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ export interface MenuItem {
|
|||||||
export interface MenuSettings {
|
export interface MenuSettings {
|
||||||
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
||||||
title: string;
|
title: string;
|
||||||
|
canClose?: boolean;
|
||||||
items: Array<MenuItem>;
|
items: Array<MenuItem>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,6 +37,7 @@ const ListMenu: React.FC = () => {
|
|||||||
const listRefs = useRef<Array<HTMLDivElement | null>>([]);
|
const listRefs = useRef<Array<HTMLDivElement | null>>([]);
|
||||||
|
|
||||||
const closeMenu = (ignoreFetch?: boolean) => {
|
const closeMenu = (ignoreFetch?: boolean) => {
|
||||||
|
if (menu.canClose === false) return;
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
if (!ignoreFetch) fetchNui('closeMenu');
|
if (!ignoreFetch) fetchNui('closeMenu');
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user