formatting

This commit is contained in:
erik-sn committed 2020-10-18 13:38:01 -04:00
1 parent e48263838f
commit 3a1bd75f97
23 files changed
+309 -236

No files matched your search

@@ -1,15 +1,11 @@
import React from "react";
import ListItemText from "@material-ui/core/ListItemText";
import {
Button,
ListItemAvatar,
Avatar as MuiAvatar
} from "@material-ui/core";
import { Button, ListItemAvatar, Avatar as MuiAvatar } from "@material-ui/core";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faPen } from "@fortawesome/free-solid-svg-icons";
import { useFilteredContacts } from '../../hooks/useFilteredContacts';
import { useFilteredContacts } from "../../hooks/useFilteredContacts";
import PhoneIcon from "@material-ui/icons/Phone";
import ChatIcon from "@material-ui/icons/Chat";
@@ -20,7 +16,6 @@ import { useContacts } from "../../hooks/useContacts";
import Nui from "../../../../os/nui-events/utils/Nui";
export const ContactList = () => {
const { filteredContacts } = useFilteredContacts();
const contacts = useContacts();
@@ -34,31 +29,40 @@ export const ContactList = () => {
return (
<List>
{contacts.contacts.filter(contact => contact.display.includes(filteredContacts) || contact.number.includes(filteredContacts)).map((contact) => (
<ListItem key={contact.id} divider>
<ListItemAvatar>
{contact.avatar ? (
<MuiAvatar src={contact.avatar} />
): (
<MuiAvatar>{contact.display.slice(0, 1)}</MuiAvatar>
)}
</ListItemAvatar>
<ListItemText primary={contact.display} secondary={contact.number} />
<Button onClick={() => startCall(contact.number)}>
<PhoneIcon />
</Button>
<Button
onClick={() =>
console.log("Message: " + contact.display, contact.number)
}
>
<ChatIcon />
</Button>
<Button>
<FontAwesomeIcon icon={faPen} size="lg"/>
</Button>
</ListItem>
))}
{contacts.contacts
.filter(
(contact) =>
contact.display.includes(filteredContacts) ||
contact.number.includes(filteredContacts)
)
.map((contact) => (
<ListItem key={contact.id} divider>
<ListItemAvatar>
{contact.avatar ? (
<MuiAvatar src={contact.avatar} />
) : (
<MuiAvatar>{contact.display.slice(0, 1)}</MuiAvatar>
)}
</ListItemAvatar>
<ListItemText
primary={contact.display}
secondary={contact.number}
/>
<Button onClick={() => startCall(contact.number)}>
<PhoneIcon />
</Button>
<Button
onClick={() =>
console.log("Message: " + contact.display, contact.number)
}
>
<ChatIcon />
</Button>
<Button>
<FontAwesomeIcon icon={faPen} size="lg" />
</Button>
</ListItem>
))}
</List>
);
};
@@ -1,95 +1,97 @@
import React, { useState } from 'react'
import React, { useState } from "react";
import { InputBase } from "@material-ui/core";
import SearchIcon from '@material-ui/icons/Search';
import { createStyles, fade, Theme, makeStyles } from '@material-ui/core/styles';
import SearchIcon from "@material-ui/icons/Search";
import {
createStyles,
fade,
Theme,
makeStyles,
} from "@material-ui/core/styles";
import { useFilteredContacts } from '../../hooks/useFilteredContacts';
import { useFilteredContacts } from "../../hooks/useFilteredContacts";
const useStyles = makeStyles((theme: Theme) =>
const useStyles = makeStyles((theme: Theme) =>
createStyles({
bg: {
backgroundColor: "#232323",
display: 'flex',
display: "flex",
height: 60,
justifyContent: 'center',
alignItems: 'center'
justifyContent: "center",
alignItems: "center",
},
textFieldInput: {
fontSize: 20
fontSize: 20,
},
inputRoot: {
color: '#fff',
fontSize: 18
color: "#fff",
fontSize: 18,
},
inputInput: {
padding: theme.spacing(1, 4, 1, 4),
// vertical padding + font size from searchIcon
transition: theme.transitions.create('width'),
width: '100%',
[theme.breakpoints.up('sm')]: {
width: '13ch',
'&:focus': {
width: '20ch',
transition: theme.transitions.create("width"),
width: "100%",
[theme.breakpoints.up("sm")]: {
width: "13ch",
"&:focus": {
width: "20ch",
},
},
},
search: {
position: 'relative',
position: "relative",
borderRadius: theme.shape.borderRadius,
backgroundColor: fade(theme.palette.common.white, 0.15),
'&:hover': {
"&:hover": {
backgroundColor: fade(theme.palette.common.white, 0.25),
},
marginLeft: 0,
width: '100%',
[theme.breakpoints.up('sm')]: {
width: "100%",
[theme.breakpoints.up("sm")]: {
marginLeft: theme.spacing(1),
width: 'auto',
width: "auto",
},
},
searchIcon: {
padding: theme.spacing(0, 0.5),
height: '100%',
position: 'absolute',
pointerEvents: 'none',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
height: "100%",
position: "absolute",
pointerEvents: "none",
display: "flex",
alignItems: "center",
justifyContent: "center",
},
})
);
export const SearchContacts = () => {
const { setFilteredContacts } = useFilteredContacts();
const classes = useStyles();
const [ searchValue, setSearchValue ] = useState('')
const [searchValue, setSearchValue] = useState("");
const handleChange = (e) => {
setSearchValue(e.target.value)
setFilteredContacts(e.target.value)
}
setSearchValue(e.target.value);
setFilteredContacts(e.target.value);
};
return (
<div className={classes.bg}>
<div className={classes.search}>
<div className={classes.searchIcon}>
<SearchIcon style={{ color: '#fff' }} />
<SearchIcon style={{ color: "#fff" }} />
</div>
<InputBase
onChange={handleChange}
placeholder="Search contacts..."
classes={{
root: classes.inputRoot,
input: classes.inputInput
input: classes.inputInput,
}}
inputProps={{ 'aria-label': 'search' }}
inputProps={{ "aria-label": "search" }}
/>
</div>
</div>
)
}
);
};