patch: tags filter design

Signed-off-by: Raul Kele <raulkeleblk@gmail.com>
This commit is contained in:
Raul Kele 2022-11-16 12:28:16 +02:00
parent 2ba9e7cc7d
commit 57d7d65070
2 changed files with 40 additions and 3 deletions

View File

@ -66,7 +66,7 @@ describe('Tags component', () => {
it('should filter tag list based on user input', async () => { it('should filter tag list based on user input', async () => {
render(<Tags tags={mockedTagsData} />); render(<Tags tags={mockedTagsData} />);
const tagFilterInput = await screen.findByPlaceholderText(/Filter tags/i); const tagFilterInput = await screen.findByPlaceholderText(/Search for Tags/i);
expect(await screen.findByText(/latest/i)).toBeInTheDocument(); expect(await screen.findByText(/latest/i)).toBeInTheDocument();
expect(await screen.findByText(/bullseye/i)).toBeInTheDocument(); expect(await screen.findByText(/bullseye/i)).toBeInTheDocument();
userEvent.type(tagFilterInput, 'bull'); userEvent.type(tagFilterInput, 'bull');

View File

@ -3,7 +3,8 @@ import React, { useState } from 'react';
// components // components
import Typography from '@mui/material/Typography'; import Typography from '@mui/material/Typography';
import { Card, CardContent, Divider, Stack, Input, FormControl, Select, InputLabel, MenuItem } from '@mui/material'; import { Card, CardContent, Divider, Stack, InputBase, FormControl, Select, InputLabel, MenuItem } from '@mui/material';
import SearchIcon from '@mui/icons-material/Search';
import { makeStyles } from '@mui/styles'; import { makeStyles } from '@mui/styles';
import TagCard from './TagCard'; import TagCard from './TagCard';
import { tagsSortByCriteria } from 'utilities/sortCriteria'; import { tagsSortByCriteria } from 'utilities/sortCriteria';
@ -45,6 +46,25 @@ const useStyles = makeStyles(() => ({
}, },
clickCursor: { clickCursor: {
cursor: 'pointer' cursor: 'pointer'
},
search: {
position: 'relative',
minWidth: '100%',
flexDirection: 'row',
marginBottom: '1.7rem',
boxShadow: '0rem 0.3125rem 0.625rem rgba(131, 131, 131, 0.08)',
border: '0.125rem solid #E7E7E7',
borderRadius: '1rem',
zIndex: 1155
},
searchIcon: {
color: '#52637A',
paddingRight: '3%'
},
input: {
color: '#464141',
marginLeft: 1,
width: '90%'
} }
})); }));
@ -116,7 +136,6 @@ export default function Tags(props) {
))} ))}
</Select> </Select>
</FormControl> </FormControl>
<Input placeholder="Filter Tags" type="text" value={tagsFilter} onChange={handleTagsFilterChange}></Input>
</div> </div>
</Stack> </Stack>
<Divider <Divider
@ -128,6 +147,24 @@ export default function Tags(props) {
width: '100%' width: '100%'
}} }}
/> />
<Stack
className={classes.search}
direction="row"
alignItems="center"
justifyContent="space-between"
spacing={2}
>
<InputBase
style={{ paddingLeft: 10, height: 46, color: 'rgba(0, 0, 0, 0.6)' }}
placeholder={'Search for Tags...'}
className={classes.input}
value={tagsFilter}
onChange={handleTagsFilterChange}
/>
<div className={classes.searchIcon}>
<SearchIcon />
</div>
</Stack>
{renderTags(tags)} {renderTags(tags)}
</CardContent> </CardContent>
</Card> </Card>