mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
51 lines
1.2 KiB
TypeScript
51 lines
1.2 KiB
TypeScript
import React, { useContext } from 'react';
|
|
import { Box, IconButton, InputBase, Paper } from '@material-ui/core';
|
|
import { makeStyles, Theme } from '@material-ui/core/styles';
|
|
import PhoneIcon from '@material-ui/icons/Phone';
|
|
import { DialInputCtx } from '../context/InputContext';
|
|
import Nui from '../../../os/nui-events/utils/Nui';
|
|
|
|
const useStyles = makeStyles((theme: Theme) => ({
|
|
root: {
|
|
textAlign: 'right',
|
|
paddingTop: theme.spacing(3),
|
|
paddingBottom: theme.spacing(3),
|
|
paddingLeft: theme.spacing(5),
|
|
paddingRight: theme.spacing(5),
|
|
display: 'flex',
|
|
height: 100,
|
|
},
|
|
input: {
|
|
flex: 1,
|
|
fontSize: theme.typography.h6.fontSize,
|
|
},
|
|
iconBtn: {
|
|
padding: 10,
|
|
},
|
|
}));
|
|
|
|
export const DialerInput = () => {
|
|
const classes = useStyles();
|
|
|
|
const { inputVal } = useContext(DialInputCtx)
|
|
|
|
const handleCall = (number: string) => {
|
|
Nui.send('phone:beginCall', {
|
|
number,
|
|
});
|
|
};
|
|
|
|
return (
|
|
<Box component={Paper} className={classes.root}>
|
|
<InputBase
|
|
placeholder='Enter a number'
|
|
className={classes.input}
|
|
value={inputVal}
|
|
/>
|
|
<IconButton className={classes.iconBtn}>
|
|
<PhoneIcon onClick={() => handleCall(inputVal)} />
|
|
</IconButton>
|
|
</Box>
|
|
);
|
|
};
|