Skip to content

Commit 67b2ed0

Browse files
committed
feat: pagination and search in dashboard
1 parent e784109 commit 67b2ed0

File tree

7 files changed

+171
-102
lines changed

7 files changed

+171
-102
lines changed

src/ui/components/Filtering/Filtering.jsx

Whitespace-only changes.

src/ui/components/Search/Search.css

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,18 @@
1-
/* Search.css */
2-
3-
.search-container {
4-
display: flex;
5-
align-items: center;
6-
margin-bottom: 10px;
7-
margin-top: 10px;
8-
margin-right: 10 px;
1+
.search-bar {
2+
width: 100%;
3+
max-width:100%; /* Sets a maximum width for the bar, adjust as needed */
4+
margin: 0 auto 20px auto; /* Centering the search bar with margin */
95
}
106

117
.search-input {
8+
width: 100%;
129
padding: 10px;
13-
margin-right: 8px;
10+
font-size: 16px;
1411
border: 1px solid #ccc;
15-
border-radius: 10px;
16-
width: 200px; /* Adjust width as needed */
17-
font-size: 14px;
18-
transition: border-color 0.3s;
12+
border-radius: 4px;
13+
box-sizing: border-box; /* Ensures padding is included in the width calculation */
1914
}
2015

2116
.search-input:focus {
22-
border-color: #007bff; /* Change to your desired focus color */
23-
outline: none; /* Remove default outline */
24-
}
25-
26-
.search-button {
27-
padding: 10px 16px;
28-
border: none;
29-
border-radius: 10px;
30-
background-color: #007bff; /* Change to your desired button color */
31-
color: white;
32-
cursor: pointer;
33-
font-size: 14px;
34-
transition: background-color 0.3s;
35-
}
36-
37-
.search-button:hover {
38-
background-color: #0056b3; /* Darker shade for hover effect */
17+
border-color: #007bff; /* Change border color when focused */
3918
}

src/ui/components/Search/Search.jsx

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,37 @@
1-
import React, { useState } from 'react';
2-
import PropTypes from 'prop-types';
1+
import React from 'react';
2+
import { TextField } from '@material-ui/core';
33
import './Search.css';
4+
import InputAdornment from '@material-ui/core/InputAdornment';
5+
import SearchIcon from '@material-ui/icons/Search'; // Import the Search Icon
46

5-
export default function Search({ placeholder = 'Search...', onSearch }) {
6-
const [query, setQuery] = useState('');
77

8-
const handleInputChange = (e) => {
9-
setQuery(e.target.value);
10-
};
11-
12-
const handleSearch = () => {
13-
onSearch(query);
14-
};
15-
16-
const handleKeyDown = (event) => {
17-
if (event.key === 'Enter') {
18-
handleSearch();
19-
}
8+
export default function Search({ onSearch }) {
9+
const handleSearchChange = (event) => {
10+
const query = event.target.value;
11+
onSearch(query); // Pass the search query to parent component
2012
};
2113

2214
return (
23-
<div className="search-container">
24-
<input
25-
type="text"
26-
placeholder={placeholder}
27-
value={query}
28-
onChange={handleInputChange}
29-
onKeyDown={handleKeyDown}
30-
className="search-input"
15+
<div style={{ margin: '20px 0' }}>
16+
<TextField
17+
label="Search"
18+
variant="outlined"
19+
fullWidth
20+
margin="normal"
21+
onChange={handleSearchChange} // Trigger onSearch on every change
22+
placeholder="Search..."
23+
InputProps={{
24+
startAdornment: (
25+
<InputAdornment position="start">
26+
<SearchIcon />
27+
</InputAdornment>
28+
),
29+
}}
3130
/>
32-
<button onClick={handleSearch} className="search-button">
33-
Search
34-
</button>
3531
</div>
3632
);
3733
}
3834

39-
Search.propTypes = {
40-
placeholder: PropTypes.string,
41-
onSearch: PropTypes.func.isRequired,
42-
};
35+
36+
37+

src/ui/views/OpenPushRequests/OpenPushRequests.jsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@ import GridContainer from '../../components/Grid/GridContainer';
44
import PushesTable from './components/PushesTable';
55
import CustomTabs from '../../components/CustomTabs/CustomTabs';
66

7+
78
import { Visibility, CheckCircle, Cancel, Block } from '@material-ui/icons';
89

910
export default function Dashboard() {
11+
12+
13+
1014
return (
1115
<div>
1216
<GridContainer>
1317
<GridItem xs={12} sm={12} md={12}>
18+
1419
<CustomTabs
1520
headerColor='primary'
1621
tabs={[
@@ -23,23 +28,27 @@ export default function Dashboard() {
2328
authorised={false}
2429
rejected={false}
2530
canceled={false}
31+
2632
/>
2733
),
2834
},
2935
{
3036
tabName: 'Approved',
3137
tabIcon: CheckCircle,
32-
tabContent: <PushesTable authorised={true} />,
38+
tabContent: <PushesTable
39+
authorised={true}
40+
41+
/>,
3342
},
3443
{
3544
tabName: 'Canceled',
3645
tabIcon: Cancel,
37-
tabContent: <PushesTable authorised={false} rejected={false} canceled={true} />,
46+
tabContent: <PushesTable authorised={false} rejected={false} canceled={true} />,
3847
},
3948
{
4049
tabName: 'Rejected',
4150
tabIcon: Block,
42-
tabContent: <PushesTable authorised={false} rejected={true} canceled={false} />,
51+
tabContent: <PushesTable authorised={false} rejected={true} canceled={false} />,
4352
},
4453
]}
4554
/>

0 commit comments

Comments
 (0)