mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-03 14:38:45 +00:00
feat(bank): new states and hooks
This commit is contained in:
1 parent
bc017f8629
commit
ad3cd5f19a
5 files changed
+69
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import React from "react";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import { Typography ,makeStyles } from "@material-ui/core";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
height: "90px",
|
||||
width: "100%",
|
||||
display: "block",
|
||||
margin: 0,
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
background: "#424242",
|
||||
},
|
||||
icon: {
|
||||
color: "#f44336",
|
||||
fontSize: 40,
|
||||
},
|
||||
}));
|
||||
|
||||
|
||||
export const BankTitle = () => {
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<Paper className={classes.root} square variant="outlined" elevation={24}>
|
||||
<Typography style={{ margin: 0}} variant="h4">WhoDis Banking</Typography>
|
||||
|
||||
|
||||
<Typography variant="subtitle2">Some player name</Typography>
|
||||
</Paper>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
import { atom } from 'recoil';
|
||||
|
||||
export const bankState = {
|
||||
transactions: atom({
|
||||
key: 'transactionList',
|
||||
default: []
|
||||
}),
|
||||
bankModal: atom({
|
||||
key: 'modalVisibility',
|
||||
default: false,
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { bankState } from './state';
|
||||
|
||||
export const useBankModal = () => {
|
||||
const [ showBankModal, setShowBankModal ] = useRecoilState(bankState.bankModal);
|
||||
return { showBankModal, setShowBankModal };
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
|
||||
import { bankState } from './state';
|
||||
import { useTransactions } from './useTransactions'
|
||||
import { useSetRecoilState } from 'recoil'
|
||||
|
||||
export const useBankService = () => {
|
||||
const setTransaction = useSetRecoilState(bankState.transactions)
|
||||
useNuiEvent('BANK', 'setTransaction', setTransaction);
|
||||
return useTransactions;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { useRecoilValue } from "recoil";
|
||||
import { bankState } from './state';
|
||||
|
||||
export const useTransactions = () => {
|
||||
const transactionList = useRecoilValue(bankState.transactions);
|
||||
return { transactionList };
|
||||
};
|
||||
Reference in new issue
Block a user