Skip to content

Commit e1b99a8

Browse files
author
Nitish Agrahari
committedApr 2, 2021
fix: material table icons fixed
Icons imported properly for material table of user record.
1 parent bb86fc1 commit e1b99a8

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed
 

‎src/components/AllUsers.tsx

+34-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { FunctionComponent, useEffect, useState, ChangeEvent } from "react";
1+
import React, { FunctionComponent, useEffect, useState, ChangeEvent, forwardRef } from "react";
22

33
import MaterialTable from "material-table";
44
import Edit from '@material-ui/icons/Edit';
@@ -24,6 +24,17 @@ import Avatar from "@material-ui/core/Avatar";
2424
import { UserData, SaveUserBody } from '../API';
2525
import DialogActions from '@material-ui/core/DialogActions';
2626
import DialogTitle from '@material-ui/core/DialogTitle';
27+
28+
import Search from '@material-ui/icons/Search';
29+
import Clear from '@material-ui/icons/Clear';
30+
import FirstPage from '@material-ui/icons/FirstPage';
31+
import LastPage from '@material-ui/icons/LastPage';
32+
import ChevronLeft from '@material-ui/icons/ChevronLeft';
33+
import ChevronRight from '@material-ui/icons/ChevronRight'
34+
import ArrowDownward from '@material-ui/icons/ArrowDownward';
35+
import Check from '@material-ui/icons/Check';
36+
37+
2738
import {
2839
SERVER_URL,
2940
getData,
@@ -35,6 +46,19 @@ import {
3546
import getTechSkills from '../helpers/getTechSkills';
3647
import validationCheck from '../validations/formValidation';
3748

49+
// material table
50+
const tableIcons = {
51+
Search: forwardRef((props: any, ref: any) => <Search {...props} ref={ref} />),
52+
Clear: forwardRef((props: any, ref: any) => <Clear {...props} ref={ref} />),
53+
FirstPage: forwardRef((props: any, ref: any) => <FirstPage {...props} ref={ref} />),
54+
LastPage: forwardRef((props: any, ref: any) => <LastPage {...props} ref={ref} />),
55+
NextPage: forwardRef((props: any, ref: any) => <ChevronRight {...props} ref={ref} />),
56+
PreviousPage: forwardRef((props: any, ref: any) => <ChevronLeft {...props} ref={ref} />),
57+
Check: forwardRef((props: any, ref: any) => <Check {...props} ref={ref} />),
58+
SortArrow: forwardRef((props: any, ref: any) => <ArrowDownward {...props} ref={ref} />),
59+
ResetSearch: forwardRef((props: any, ref: any) => <Clear {...props} ref={ref} />),
60+
}
61+
3862
// styling table using material styles
3963
const useStyles = makeStyles((theme) => ({
4064
root: {
@@ -153,6 +177,7 @@ const AllUsers: FunctionComponent<any> = () => {
153177
});
154178
}
155179
setAlertDialogOpen(false);
180+
setDialogOpen(false);
156181
}
157182

158183
// handler for opening alert dialog for deletion
@@ -190,6 +215,13 @@ const AllUsers: FunctionComponent<any> = () => {
190215
});
191216
}
192217
}
218+
setCheck1(false);
219+
setCheck2(false);
220+
setCheck3(false);
221+
setCheck4(false);
222+
setCheck5(false);
223+
setCheck6(false);
224+
setDialogOpen(false);
193225
}
194226

195227
const handleProfileChange = async (e: ChangeEvent<HTMLInputElement>) => {
@@ -453,6 +485,7 @@ const AllUsers: FunctionComponent<any> = () => {
453485
<div className={classes.root}>
454486
<div className={classes.subdiv}>
455487
<MaterialTable
488+
icons={tableIcons}
456489
title="List of Users"
457490
columns={[
458491
{

0 commit comments

Comments
 (0)