mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 15:06:02 +01:00
feat(web/context): allow custom metadata order
This commit is contained in:
@@ -17,7 +17,7 @@ debugData<ContextMenuProps>([
|
||||
{
|
||||
title: "Example button",
|
||||
description: "Example button description",
|
||||
metadata: { ["Value 1"]: "Some value", ["Value 2"]: 300 },
|
||||
metadata: [{ label: "Value 1", value: 300 }],
|
||||
},
|
||||
{
|
||||
title: "Menu button",
|
||||
|
||||
@@ -104,9 +104,14 @@ const Item: React.FC<{
|
||||
<PopoverBody>
|
||||
{Array.isArray(option[1].metadata) ? (
|
||||
option[1].metadata.map(
|
||||
(metadata: string, index: number) => (
|
||||
(
|
||||
metadata: string | { label: string; value: any },
|
||||
index: number
|
||||
) => (
|
||||
<Text key={`context-metadata-${index}`}>
|
||||
{metadata}
|
||||
{typeof metadata === "string"
|
||||
? `${metadata}`
|
||||
: `${metadata.label}: ${metadata.value}`}
|
||||
</Text>
|
||||
)
|
||||
)
|
||||
|
||||
@@ -3,7 +3,10 @@ export interface Option {
|
||||
title?: string;
|
||||
description?: string;
|
||||
arrow?: boolean;
|
||||
metadata?: string[] | { [key: string]: any };
|
||||
metadata?:
|
||||
| string[]
|
||||
| { [key: string]: any }
|
||||
| { label: string; value: any }[];
|
||||
event?: string;
|
||||
serverEvent?: string;
|
||||
args?: any;
|
||||
|
||||
Reference in New Issue
Block a user