summaryrefslogtreecommitdiff
path: root/admin/src/pages/VerifiedUsers/VerifiedUsers.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'admin/src/pages/VerifiedUsers/VerifiedUsers.jsx')
-rw-r--r--admin/src/pages/VerifiedUsers/VerifiedUsers.jsx25
1 files changed, 23 insertions, 2 deletions
diff --git a/admin/src/pages/VerifiedUsers/VerifiedUsers.jsx b/admin/src/pages/VerifiedUsers/VerifiedUsers.jsx
index 12d1317..c03791c 100644
--- a/admin/src/pages/VerifiedUsers/VerifiedUsers.jsx
+++ b/admin/src/pages/VerifiedUsers/VerifiedUsers.jsx
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, {useState} from 'react';
import Accordion from '../../components/Accordion/Accordion';
import Header from '../../components/Header/Header';
import {getVerifiedUsers} from '../../services/apiservice';
@@ -9,13 +9,34 @@ import styles from './VerifiedUsers.module.css';
const VerifiedUsers = () => {
const {data} = useQuery('verified', getVerifiedUsers);
+ const [inputText, setInputText] = useState("");
+
+ const inputHandler = (e) => {
+ const lowerCase = e.target.value.toLowerCase();
+ setInputText(lowerCase);
+ };
+
+ const filteredData = data?.data?.filter((el) => {
+ if (inputText === '') {
+ return el;
+ } else {
+ return el.name.toLowerCase().includes(inputText);
+ }
+ })
+
return (
<div className={styles.verified_users}>
<Header subheading='Admin' />
+ <h1 className={styles.unverified_users__heading}>Search</h1>
+ <input
+ className={styles.input__search}
+ onChange={inputHandler}
+ placeholder="Enter name of user to search"
+ />
<h1 className={styles.verified_users__heading}>Verified Users</h1>
<div className='accordion'>
{data?.data.length !== 0 ? (
- data?.data.map((item) => (
+ filteredData?.map((item) => (
<div>
<Accordion name={item.name} user={item} />
</div>