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