mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 15:36:02 +01:00
feat(nui): Icon support for custom notifications
This commit is contained in:
@@ -7,6 +7,11 @@
|
|||||||
"@chakra-ui/react": "^1.8.6",
|
"@chakra-ui/react": "^1.8.6",
|
||||||
"@emotion/react": "11",
|
"@emotion/react": "11",
|
||||||
"@emotion/styled": "11",
|
"@emotion/styled": "11",
|
||||||
|
"@fortawesome/fontawesome-svg-core": "^6.1.0",
|
||||||
|
"@fortawesome/free-brands-svg-icons": "^6.1.0",
|
||||||
|
"@fortawesome/free-regular-svg-icons": "^6.1.0",
|
||||||
|
"@fortawesome/free-solid-svg-icons": "^6.1.0",
|
||||||
|
"@fortawesome/react-fontawesome": "^0.1.18",
|
||||||
"@testing-library/jest-dom": "^5.16.1",
|
"@testing-library/jest-dom": "^5.16.1",
|
||||||
"@testing-library/react": "^12.1.2",
|
"@testing-library/react": "^12.1.2",
|
||||||
"@testing-library/user-event": "^13.5.0",
|
"@testing-library/user-event": "^13.5.0",
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { useToast, type ToastPositionWithLogical, Box } from "@chakra-ui/react";
|
import { useToast, type ToastPositionWithLogical, Box } from "@chakra-ui/react";
|
||||||
import { useNuiEvent } from "../hooks/useNuiEvent";
|
import { useNuiEvent } from "../hooks/useNuiEvent";
|
||||||
import { debugData } from "../utils/debugData";
|
import { debugData } from "../utils/debugData";
|
||||||
|
import { IconProp } from "@fortawesome/fontawesome-svg-core";
|
||||||
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title?: string;
|
title?: string;
|
||||||
@@ -17,7 +19,7 @@ interface CustomProps {
|
|||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
text: string;
|
text: string;
|
||||||
duration?: number;
|
duration?: number;
|
||||||
icon?: string;
|
icon?: IconProp;
|
||||||
position?: ToastPositionWithLogical;
|
position?: ToastPositionWithLogical;
|
||||||
id?: number;
|
id?: number;
|
||||||
}
|
}
|
||||||
@@ -38,9 +40,10 @@ debugData<CustomProps>([
|
|||||||
action: "customNotify",
|
action: "customNotify",
|
||||||
data: {
|
data: {
|
||||||
text: "Dunak is nerd",
|
text: "Dunak is nerd",
|
||||||
|
icon: "clipboard-check",
|
||||||
style: {
|
style: {
|
||||||
backgroundColor: "red",
|
backgroundColor: "#2D3748",
|
||||||
color: "purple",
|
color: "white",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -57,6 +60,7 @@ const Notifications: React.FC = () => {
|
|||||||
position: data.position || "top-right",
|
position: data.position || "top-right",
|
||||||
render: () => (
|
render: () => (
|
||||||
<Box style={data.style} p={3}>
|
<Box style={data.style} p={3}>
|
||||||
|
{data.icon && <FontAwesomeIcon icon={data.icon} />}
|
||||||
{data.text}
|
{data.text}
|
||||||
</Box>
|
</Box>
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -6,6 +6,12 @@ import { VisibilityProvider } from "./providers/VisibilityProvider";
|
|||||||
import { ChakraProvider } from "@chakra-ui/react";
|
import { ChakraProvider } from "@chakra-ui/react";
|
||||||
import { theme } from "./theme";
|
import { theme } from "./theme";
|
||||||
import { debugData } from "./utils/debugData";
|
import { debugData } from "./utils/debugData";
|
||||||
|
import { fas } from "@fortawesome/free-solid-svg-icons";
|
||||||
|
import { far } from "@fortawesome/free-regular-svg-icons";
|
||||||
|
import { fab } from "@fortawesome/free-brands-svg-icons";
|
||||||
|
import { library } from "@fortawesome/fontawesome-svg-core";
|
||||||
|
|
||||||
|
library.add(fas, far, fab);
|
||||||
|
|
||||||
debugData([
|
debugData([
|
||||||
{
|
{
|
||||||
|
|||||||
2601
web/yarn.lock
2601
web/yarn.lock
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user