mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 15:06:02 +01:00
* feat: Support image Tag in buttons in my server. ox_lib is heavily used. most of sample use cases for this is. Food image, Ingredients, Vehicle Parts, etc.. i believe font awesome is not enough for some use cases. i did suggest this on v3 pending PR. but it seems gets ignored. here i am gonna try to push this PR. to use this. icon must be not existing in the options. if both icon and image is in options, nothing will appear. image in metadata will still appear normaly. * tweak(web/menu): resize render image comparable to FA * refactor(web/context): use icon prop for images * refactor(web/list): use icon prop for images --------- Co-authored-by: Luke <39926192+LukeWasTakenn@users.noreply.github.com>
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { IconName, IconPrefix } from '@fortawesome/fontawesome-common-types';
|
|
|
|
interface ContextMenuItem {
|
|
menu?: string;
|
|
title?: string;
|
|
description?: string;
|
|
arrow?: boolean;
|
|
image?: string;
|
|
icon?: IconName | [IconPrefix, IconName] | string;
|
|
iconColor?: string;
|
|
progress?: number;
|
|
colorScheme?: string;
|
|
onSelect?: (args: any) => void;
|
|
metadata?: string[] | { [key: string]: any } | { label: string; value: any; progress?: number }[];
|
|
disabled?: boolean;
|
|
event?: string;
|
|
serverEvent?: string;
|
|
args?: any;
|
|
}
|
|
|
|
interface ContextMenuArrayItem extends ContextMenuItem {
|
|
title: string;
|
|
}
|
|
|
|
interface ContextMenuProps {
|
|
id: string;
|
|
title: string;
|
|
menu?: string;
|
|
onExit?: () => void;
|
|
onBack?: () => void;
|
|
canClose?: boolean;
|
|
options: { [key: string]: ContextMenuItem } | ContextMenuArrayItem[];
|
|
}
|
|
|
|
type registerContext = (context: ContextMenuProps | ContextMenuProps[]) => void;
|
|
export const registerContext: registerContext = (context) => exports.ox_lib.registerContext(context);
|
|
|
|
export const showContext = (id: string): void => exports.ox_lib.showContext(id);
|
|
|
|
export const hideContext = (onExit: boolean): void => exports.ox_lib.hideContext(onExit);
|
|
|
|
export const getOpenContextMenu = (): string | null => exports.ox_lib.getOpenContextMenu();
|