mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +00:00
Tweak(Contacts): New layout for modal
This commit is contained in:
1 parent
3cdbf4860d
commit
280a34f785
1 file changed
+53
-21
@@ -1,11 +1,15 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { makeStyles } from "@material-ui/core/styles";
|
import { makeStyles, Theme } from "@material-ui/core/styles";
|
||||||
import { Button, TextField, Paper } from "@material-ui/core";
|
import { Button, TextField } from "@material-ui/core";
|
||||||
import Nui from "../../../os/nui-events/utils/Nui";
|
import Nui from "../../../os/nui-events/utils/Nui";
|
||||||
import List from "@material-ui/core/List";
|
import List from "@material-ui/core/List";
|
||||||
import ListItem from "@material-ui/core/ListItem";
|
import ListItem from "@material-ui/core/ListItem";
|
||||||
|
import Modal from '../../../ui/components/Modal';
|
||||||
|
import { useModal } from '../hooks/useModal';
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
import '../components/Contact.css'
|
||||||
|
|
||||||
|
const useStyles = makeStyles((theme: Theme) => ({
|
||||||
button: {
|
button: {
|
||||||
margin: 5,
|
margin: 5,
|
||||||
marginTop: 20,
|
marginTop: 20,
|
||||||
@@ -18,23 +22,33 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
marginLeft: "-4em",
|
marginLeft: "-4em",
|
||||||
height: "20%",
|
height: "20%",
|
||||||
},
|
},
|
||||||
|
textInputField: {
|
||||||
displayBlock: {
|
fontSize: 20,
|
||||||
/*Sets modal to center*/
|
borderBottomColor: 'red'
|
||||||
display: "flex",
|
|
||||||
justifyContent: "center",
|
|
||||||
alignItems: "center",
|
|
||||||
},
|
},
|
||||||
displayNone: {
|
addBtn: {
|
||||||
display: "none",
|
margin: 'auto',
|
||||||
|
width: 150,
|
||||||
|
background: "#2196f3",
|
||||||
|
marginBottom: 10,
|
||||||
|
padding: 8
|
||||||
},
|
},
|
||||||
|
cancelBtn: {
|
||||||
|
margin: 'auto',
|
||||||
|
width: 150,
|
||||||
|
background: "#232323",
|
||||||
|
marginBottom: 20,
|
||||||
|
padding: 8
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const AddContactModal = ({ handleClose, show }) => {
|
export const AddContactModal = () => {
|
||||||
const [name, setName] = useState("");
|
const [name, setName] = useState("");
|
||||||
const [number, setNumber] = useState("");
|
const [number, setNumber] = useState("");
|
||||||
|
const [avatar, setAvatar] = useState("");
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const showHideClassName = show ? classes.displayBlock : classes.displayNone;
|
|
||||||
|
const { showModal, setShowModal } = useModal();
|
||||||
|
|
||||||
const addContact = () => {
|
const addContact = () => {
|
||||||
if (name === "" || number === "") {
|
if (name === "" || number === "") {
|
||||||
@@ -43,37 +57,55 @@ export const AddContactModal = ({ handleClose, show }) => {
|
|||||||
Nui.send("contacts:add", {
|
Nui.send("contacts:add", {
|
||||||
name,
|
name,
|
||||||
number,
|
number,
|
||||||
|
avatar
|
||||||
});
|
});
|
||||||
console.log(name, number);
|
console.log(name, number, avatar);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const _handleClose = () => {
|
||||||
|
setShowModal(false)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={showHideClassName}>
|
<Modal visible={showModal} handleClose={_handleClose}>
|
||||||
<Paper className={classes.root}>
|
<List style={{ marginTop: 10 }}>
|
||||||
<List>
|
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<TextField
|
<TextField
|
||||||
value={name}
|
value={name}
|
||||||
|
inputProps={{ className: classes.textInputField}}
|
||||||
onChange={(e) => setName(e.target.value)}
|
onChange={(e) => setName(e.target.value)}
|
||||||
style={{ fontSize: "18px" }}
|
style={{ fontSize: "18px" }}
|
||||||
fullWidth
|
fullWidth
|
||||||
|
variant="outlined"
|
||||||
placeholder="Name"
|
placeholder="Name"
|
||||||
/>
|
/>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<TextField
|
<TextField
|
||||||
value={number}
|
value={number}
|
||||||
|
inputProps={{ className: classes.textInputField}}
|
||||||
onChange={(e) => setNumber(e.target.value)}
|
onChange={(e) => setNumber(e.target.value)}
|
||||||
fullWidth
|
fullWidth
|
||||||
placeholder="Number"
|
placeholder="Number"
|
||||||
|
variant="outlined"
|
||||||
type="number"
|
type="number"
|
||||||
/>
|
/>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
<ListItem>
|
||||||
|
<TextField
|
||||||
|
value={avatar}
|
||||||
|
inputProps={{ className: classes.textInputField}}
|
||||||
|
onChange={(e) => setAvatar(e.target.value)}
|
||||||
|
fullWidth
|
||||||
|
placeholder="Picture link"
|
||||||
|
variant="standard"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
</ListItem>
|
||||||
</List>
|
</List>
|
||||||
<Button onClick={addContact}>Add</Button>
|
<Button className={classes.addBtn} onClick={addContact}>Add Contact</Button>
|
||||||
<Button onClick={handleClose}>Close</Button>
|
<Button className={classes.cancelBtn} onClick={_handleClose}>Cancel</Button>
|
||||||
</Paper>
|
</Modal>
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
Reference in new issue
Block a user