mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
Feat / Reusable SearchField + Fixed Messages align bottom flex with scroll (first message starts at bottom) (#151)
* feat(phone/ui): Make SearchField a reusable component * Fixed conversation scrolling and align bottom * feat(phone/ui): Autoscroll fix * feat(phone/ui): Autoscroll fix remove unused deps * feat(phone/ui): Autoscroll add needed dep for new messages
This commit is contained in:
1 parent
1659fa1654
commit
e56ae415dc
13 files changed
+162
-196
No files matched your search
@@ -1,83 +1,22 @@
|
||||
import React from 'react';
|
||||
import { InputBase } from '@material-ui/core';
|
||||
import SearchIcon from '@material-ui/icons/Search';
|
||||
import { createStyles, Theme, makeStyles } from '@material-ui/core/styles';
|
||||
import { Box } from '@material-ui/core';
|
||||
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { useFilteredContacts } from '../../hooks/useFilteredContacts';
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) =>
|
||||
createStyles({
|
||||
bg: {
|
||||
backgroundColor: theme.palette.background.paper,
|
||||
display: 'flex',
|
||||
height: 60,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
},
|
||||
textFieldInput: {
|
||||
fontSize: 20,
|
||||
},
|
||||
inputRoot: {
|
||||
fontSize: 18,
|
||||
border: '1px solid',
|
||||
borderColor: theme.palette.divider,
|
||||
},
|
||||
inputInput: {
|
||||
padding: theme.spacing(1, 4, 1, 4),
|
||||
transition: theme.transitions.create('width'),
|
||||
[theme.breakpoints.up('sm')]: {
|
||||
width: '13ch',
|
||||
'&:focus': {
|
||||
width: '20ch',
|
||||
},
|
||||
},
|
||||
},
|
||||
search: {
|
||||
position: 'relative',
|
||||
borderRadius: theme.shape.borderRadius,
|
||||
marginLeft: 0,
|
||||
width: '100%',
|
||||
[theme.breakpoints.up('sm')]: {
|
||||
marginLeft: theme.spacing(1),
|
||||
width: 'auto',
|
||||
},
|
||||
},
|
||||
searchIcon: {
|
||||
padding: theme.spacing(0, 0.5),
|
||||
height: '100%',
|
||||
position: 'absolute',
|
||||
pointerEvents: 'none',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
}),
|
||||
);
|
||||
import { SearchField } from '../../../../ui/components/SearchField';
|
||||
|
||||
export const SearchContacts = () => {
|
||||
const { setFilteredContacts } = useFilteredContacts();
|
||||
const classes = useStyles();
|
||||
const { setFilteredContacts, filteredContacts } = useFilteredContacts();
|
||||
const { t } = useTranslation();
|
||||
|
||||
return (
|
||||
<div className={classes.bg}>
|
||||
<div className={classes.search}>
|
||||
<div className={classes.searchIcon}>
|
||||
<SearchIcon />
|
||||
</div>
|
||||
<InputBase
|
||||
fullWidth
|
||||
onChange={(e) => setFilteredContacts(e.target.value)}
|
||||
placeholder={t('APPS_CONTACT_PLACEHOLDER_SEARCH_CONTACTS')}
|
||||
classes={{
|
||||
root: classes.inputRoot,
|
||||
input: classes.inputInput,
|
||||
}}
|
||||
inputProps={{ 'aria-label': 'search', autoFocus: true }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<Box>
|
||||
<SearchField
|
||||
onChange={(e) => setFilteredContacts(e.target.value)}
|
||||
placeholder={t('APPS_CONTACT_PLACEHOLDER_SEARCH_CONTACTS')}
|
||||
value={filteredContacts}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user