feat(nui): Add markdown support to text ui

Also changed the font to be a monospaced font, avoids weird alignment issues
This commit is contained in:
Luke
2022-03-26 11:02:38 +01:00
parent a3874965bc
commit ccf00a6a9e
4 changed files with 898 additions and 471 deletions

View File

@@ -2,6 +2,7 @@ import React from "react";
import { useNuiEvent } from "../hooks/useNuiEvent";
import { Box, Flex, ScaleFade, Text } from "@chakra-ui/react";
import { debugData } from "../utils/debugData";
import ReactMarkdown from "react-markdown";
interface Props {
text: string;
@@ -13,7 +14,7 @@ debugData([
{
action: "textUi",
data: {
text: "[E] - Access locker inventory",
text: "[E] - Access locker inventory \n [G] - Do something else \n ",
position: "right-center",
},
},
@@ -53,11 +54,14 @@ const TextUI: React.FC = () => {
bg="gray.700"
boxShadow="lg"
p={3}
fontFamily="Poppins"
fontFamily="DM Mono"
style={data.style}
borderRadius="md"
maxW="xs"
>
<Text>{data.text}</Text>
<Text>
<ReactMarkdown>{data.text}</ReactMarkdown>
</Text>
</Box>
</ScaleFade>
</Flex>