Skip to content

Commit

Permalink
feat(client): Text UI functions
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeWasTakenn committed Apr 11, 2022
1 parent ff71a7d commit ed75b68
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions resource/interface/client/textui.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function lib.showTextUI(text, options)
if not options then options = {} end
options.text = text
SendNUIMessage({
action = 'textUi',
data = options
})
end

function lib.hideTextUI()
SendNUIMessage({
action = 'textUiHide'
})
end
1 change: 1 addition & 0 deletions web/src/features/textui/TextUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const TextUI: React.FC = () => {
const [visible, setVisible] = React.useState(false);

useNuiEvent<Props>("textUi", (data) => {
if (!data.position) data.position = "right-center"; // Default right position
setData(data);
setVisible(true);
});
Expand Down

0 comments on commit ed75b68

Please sign in to comment.