1+ import React from 'react' ;
2+ import PropTypes from 'prop-types' ;
3+ import { Box , Checkbox , TableRow , TableCell , TableHead , TableSortLabel , Toolbar , Tooltip , IconButton , Typography , OutlinedInput , InputAdornment } from '@mui/material' ;
4+
5+ // Label Component
6+ const Label = ( { color, children } ) => {
7+ return (
8+ < Box
9+ sx = { {
10+ display : 'inline-flex' ,
11+ alignItems : 'center' ,
12+ justifyContent : 'center' ,
13+ borderRadius : '8px' ,
14+ minWidth : 72 ,
15+ minHeight : 32 ,
16+ px : 1 ,
17+ color : 'white' ,
18+ backgroundColor : color === 'success' ? 'success.main' : 'error.main' ,
19+ } }
20+ >
21+ { children }
22+ </ Box >
23+ ) ;
24+ } ;
25+
26+ Label . propTypes = {
27+ color : PropTypes . string . isRequired ,
28+ children : PropTypes . node ,
29+ } ;
30+
31+ // Iconify Component
32+ const Iconify = ( { icon, width = 20 , sx, ...other } ) => (
33+ < Box component = "span" sx = { { display : 'inline-flex' , alignItems : 'center' , justifyContent : 'center' , width, height : width , ...sx } } { ...other } >
34+ < i className = { icon } />
35+ </ Box >
36+ ) ;
37+
38+ Iconify . propTypes = {
39+ sx : PropTypes . object ,
40+ width : PropTypes . oneOfType ( [ PropTypes . number , PropTypes . string ] ) ,
41+ icon : PropTypes . string . isRequired ,
42+ } ;
43+
44+ // Scrollbar Component
45+ const Scrollbar = ( { children, sx, ...other } ) => {
46+ return (
47+ < Box sx = { { overflowX : 'auto' , ...sx } } { ...other } >
48+ { children }
49+ </ Box >
50+ ) ;
51+ } ;
52+
53+ Scrollbar . propTypes = {
54+ sx : PropTypes . object ,
55+ children : PropTypes . node ,
56+ } ;
57+
58+ const UserListHead = ( {
59+ order,
60+ orderBy,
61+ rowCount,
62+ headLabel,
63+ numSelected,
64+ onRequestSort,
65+ onSelectAllClick,
66+ } ) => {
67+ const createSortHandler = ( property ) => ( event ) => {
68+ onRequestSort ( event , property ) ;
69+ } ;
70+
71+ return (
72+ < TableHead
73+ sx = { {
74+ bgcolor : "grey.200" , // Add this line to set the background color to grey
75+ } }
76+ >
77+ < TableRow >
78+ < TableCell padding = "checkbox" >
79+ < Checkbox
80+ indeterminate = { numSelected > 0 && numSelected < rowCount }
81+ checked = { rowCount > 0 && numSelected === rowCount }
82+ onChange = { onSelectAllClick }
83+ />
84+ </ TableCell >
85+ { headLabel . map ( ( headCell ) => (
86+ < TableCell
87+ key = { headCell . id }
88+ align = { headCell . alignRight ? "right" : "left" }
89+ sortDirection = { orderBy === headCell . id ? order : false }
90+ >
91+ < TableSortLabel
92+ hideSortIcon
93+ active = { orderBy === headCell . id }
94+ direction = { orderBy === headCell . id ? order : "asc" }
95+ onClick = { createSortHandler ( headCell . id ) }
96+ >
97+ { headCell . label }
98+ </ TableSortLabel >
99+ </ TableCell >
100+ ) ) }
101+ </ TableRow >
102+ </ TableHead >
103+ ) ;
104+ } ;
105+
106+
107+ UserListHead . propTypes = {
108+ order : PropTypes . oneOf ( [ 'asc' , 'desc' ] ) ,
109+ orderBy : PropTypes . string ,
110+ rowCount : PropTypes . number ,
111+ headLabel : PropTypes . array ,
112+ numSelected : PropTypes . number ,
113+ onRequestSort : PropTypes . func ,
114+ onSelectAllClick : PropTypes . func ,
115+ } ;
116+ const UserListToolbar = ( { numSelected, filterName, onFilterName, backgroundColor } ) => {
117+ return (
118+ < Toolbar
119+ sx = { {
120+ height : 96 ,
121+ display : 'flex' ,
122+ justifyContent : 'space-between' ,
123+ padding : 1 ,
124+ backgroundColor : 'background.paper' , // Add this line to set the background color to white
125+ ...( numSelected > 0 && {
126+ color : 'primary.main' ,
127+ bgcolor : 'primary.lighter' ,
128+ } ) ,
129+ } }
130+ >
131+ { numSelected > 0 ? (
132+ < Typography component = "div" variant = "subtitle1" >
133+ { numSelected } selected
134+ </ Typography >
135+ ) : (
136+ < OutlinedInput
137+ value = { filterName }
138+ onChange = { onFilterName }
139+ placeholder = "Search applicant..."
140+ startAdornment = {
141+ < InputAdornment position = "start" >
142+ < Iconify icon = "eva:search-fill" sx = { { color : 'text.disabled' , width : 20 , height : 20 } } />
143+ </ InputAdornment >
144+ }
145+ sx = { {
146+ width : 240 ,
147+ transition : 'all 0.3s' ,
148+ '&.Mui-focused' : {
149+ width : 320 ,
150+ boxShadow : 8 ,
151+ } ,
152+ '& fieldset' : {
153+ borderWidth : `1px !important` ,
154+ borderColor : 'rgba(0, 0, 0, 0.23) !important' ,
155+ } ,
156+ } }
157+ />
158+ ) }
159+ </ Toolbar >
160+ ) ;
161+ } ;
162+
163+ UserListToolbar . propTypes = {
164+ numSelected : PropTypes . number ,
165+ filterName : PropTypes . string ,
166+ onFilterName : PropTypes . func ,
167+ } ;
168+
169+
170+ export { Label , Iconify , Scrollbar , UserListHead , UserListToolbar } ;
0 commit comments