mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
feat(DialerInput): calling from DialPage
This commit is contained in:
1 parent
856a7ef7ef
commit
827f98bba1
2 files changed
+44
-22
No files matched your search
@@ -2,6 +2,8 @@ import React 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: {
|
||||
@@ -25,12 +27,26 @@ const useStyles = makeStyles((theme: Theme) => ({
|
||||
export const DialerInput = () => {
|
||||
const classes = useStyles();
|
||||
|
||||
const handleCall = (number: string) => {
|
||||
Nui.send('phone:beginCall', {
|
||||
number
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<Box component={Paper} className={classes.root}>
|
||||
<InputBase placeholder='Enter a number' className={classes.input} />
|
||||
<IconButton className={classes.iconBtn}>
|
||||
<PhoneIcon />
|
||||
</IconButton>
|
||||
</Box>
|
||||
<DialInputCtx.Consumer>
|
||||
{({ inputVal, add }) => (
|
||||
<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>
|
||||
)}
|
||||
</DialInputCtx.Consumer>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user