mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-19 07:56:02 +01:00
refactor(nui): Context menu style adjustments
This commit is contained in:
@@ -2,6 +2,7 @@ import { useNuiEvent } from "../hooks/useNuiEvent";
|
|||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Text,
|
Text,
|
||||||
|
Flex,
|
||||||
Popover,
|
Popover,
|
||||||
PopoverTrigger,
|
PopoverTrigger,
|
||||||
Portal,
|
Portal,
|
||||||
@@ -41,6 +42,16 @@ debugData<Props>([
|
|||||||
description: "Even cooler vehicle",
|
description: "Even cooler vehicle",
|
||||||
metadata: ["Plate: JGM 971", "Status: In garage"],
|
metadata: ["Plate: JGM 971", "Status: In garage"],
|
||||||
},
|
},
|
||||||
|
["Burger"]: {
|
||||||
|
description: "Make a delicious burger",
|
||||||
|
metadata: {
|
||||||
|
["Bun"]: 3,
|
||||||
|
["Lettuce"]: 2,
|
||||||
|
["Meat"]: 1,
|
||||||
|
["Tomato"]: 1,
|
||||||
|
["Cheese"]: 2,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -59,15 +70,15 @@ const ContextMenu: React.FC = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Flex
|
||||||
position="absolute"
|
position="absolute"
|
||||||
w="xs"
|
w="75%"
|
||||||
h="fit-content"
|
h="80%"
|
||||||
maxH="20rem"
|
justifyContent="flex-end"
|
||||||
top="20%"
|
alignItems="center"
|
||||||
right="25%"
|
|
||||||
>
|
>
|
||||||
<Box borderRadius="md" bg="gray.700" mb={3}>
|
<Box w="xs" h={580}>
|
||||||
|
<Box borderRadius="md" bg="gray.800" mb={3}>
|
||||||
<Text
|
<Text
|
||||||
fontFamily="Poppins"
|
fontFamily="Poppins"
|
||||||
fontSize="md"
|
fontSize="md"
|
||||||
@@ -78,7 +89,7 @@ const ContextMenu: React.FC = () => {
|
|||||||
{contextMenu.title}
|
{contextMenu.title}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
<Box maxH="33rem" overflowY="scroll">
|
<Box maxH={560} overflowY="scroll">
|
||||||
{Object.entries(contextMenu.options).map((option, index) => (
|
{Object.entries(contextMenu.options).map((option, index) => (
|
||||||
<Popover
|
<Popover
|
||||||
placement="right-start"
|
placement="right-start"
|
||||||
@@ -88,7 +99,7 @@ const ContextMenu: React.FC = () => {
|
|||||||
>
|
>
|
||||||
<PopoverTrigger>
|
<PopoverTrigger>
|
||||||
<Box
|
<Box
|
||||||
bg="gray.700"
|
bg="gray.800"
|
||||||
borderRadius="md"
|
borderRadius="md"
|
||||||
h="fit-content"
|
h="fit-content"
|
||||||
w="100%"
|
w="100%"
|
||||||
@@ -97,7 +108,7 @@ const ContextMenu: React.FC = () => {
|
|||||||
fontFamily="Poppins"
|
fontFamily="Poppins"
|
||||||
fontSize="md"
|
fontSize="md"
|
||||||
transition="300ms"
|
transition="300ms"
|
||||||
_hover={{ bg: "gray.800" }}
|
_hover={{ bg: "gray.700" }}
|
||||||
key={`option-${index}`}
|
key={`option-${index}`}
|
||||||
>
|
>
|
||||||
{/* TODO: react-markdown (?) */}
|
{/* TODO: react-markdown (?) */}
|
||||||
@@ -112,7 +123,14 @@ const ContextMenu: React.FC = () => {
|
|||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
<Portal>
|
<Portal>
|
||||||
<PopoverContent fontFamily="Poppins" bg="gray.800">
|
<PopoverContent
|
||||||
|
fontFamily="Poppins"
|
||||||
|
bg="gray.800"
|
||||||
|
outline="none"
|
||||||
|
border="none"
|
||||||
|
w="fit-content"
|
||||||
|
maxW="2xs"
|
||||||
|
>
|
||||||
<PopoverBody>
|
<PopoverBody>
|
||||||
{option[1]?.metadata &&
|
{option[1]?.metadata &&
|
||||||
Array.isArray(option[1].metadata) ? (
|
Array.isArray(option[1].metadata) ? (
|
||||||
@@ -142,6 +160,7 @@ const ContextMenu: React.FC = () => {
|
|||||||
))}
|
))}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
</Flex>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ const TextUI: React.FC = () => {
|
|||||||
w="100%"
|
w="100%"
|
||||||
h="100%"
|
h="100%"
|
||||||
p={3}
|
p={3}
|
||||||
|
position="absolute"
|
||||||
alignItems={data.position === "top-center" ? "baseline" : "center"}
|
alignItems={data.position === "top-center" ? "baseline" : "center"}
|
||||||
justifyContent={
|
justifyContent={
|
||||||
data.position === "right-center"
|
data.position === "right-center"
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ body {
|
|||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
overflow: hidden !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#root {
|
#root {
|
||||||
|
|||||||
Reference in New Issue
Block a user