Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Add No Results text deisplay on search results #143

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/components/noResultsFound/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.bg-container{
display: flex;
flex-direction: column;
height: 50vh;
justify-content: center;
align-items: center;
}

.bg-container h1{
font-size: 30px;
color: rgb(36, 36, 36);
}

.bg-container p{
color: #757575;
}
11 changes: 11 additions & 0 deletions src/components/noResultsFound/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import './index.css'
const NoResultsFound = () => {
return(
<div className='bg-container'>
<h1>No Result Found</h1>
<p>We can't find any item item matching your search</p>
</div>
)
}

export default NoResultsFound
3 changes: 3 additions & 0 deletions src/components/page4/lecture.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import wt from '../../assets/wt.jpg';
import se from '../../assets/se.jpg';
import bd from '../../assets/bd.jpg';
import {FaMagnifyingGlass } from 'react-icons/fa6'
import NoResultsFound from '../noResultsFound/index.js'

function Lecture() {
// State for search query
Expand Down Expand Up @@ -56,6 +57,7 @@ function Lecture() {
/>
</div>
{/* Display filtered lecture items */}
{ filteredItems.length !== 0 ?
<div className="container">
{filteredItems.map((item, index) => (
<div className="box" key={index}>
Expand All @@ -67,6 +69,7 @@ function Lecture() {
</div>
))}
</div>
: <NoResultsFound />}
</div>
);
}
Expand Down
5 changes: 3 additions & 2 deletions src/components/page4/trdquantum.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Imgcn from '../../assets/cn.webp';
import Imgwt from '../../assets/wt.png';
import Imgitcs from '../../assets/itcsimg.jpg';
import {FaMagnifyingGlass } from 'react-icons/fa6'
import NoResultsFound from '../noResultsFound/index.js'
const quantumBooks = [
{ img: Imgcd, title: "Compiler Design", file: "cd" },
{ img: Imgda, title: "Data Analytics", file: "DataAnalytics" },
Expand Down Expand Up @@ -66,7 +67,7 @@ function Quantum() {

</div>

<div className="content" style={{ height: "auto", overflow: "auto" }}>
{ filteredBooks.length !== 0 ? <div className="content" style={{ height: "auto", overflow: "auto" }}>
{filteredBooks.map(book => (
<div className="book" key={book.title}>
<img src={book.img} alt={book.title} />
Expand All @@ -76,7 +77,7 @@ function Quantum() {
</div>
</div>
))}
</div>
</div> : <NoResultsFound />}
</div>
</div>
)
Expand Down
5 changes: 3 additions & 2 deletions src/components/page5(1st)/fstlecture.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState } from 'react';
import Header from '../../pages/header';
import './fstlecture.css';
import NoResultsFound from '../noResultsFound/index.js'

// Import images
import ec from '../../assets/ec.jpg';
Expand Down Expand Up @@ -62,7 +63,7 @@ function Lecture() {
/>
</div>
{/* Display filtered lecture items */}
<div className="container">
{ filteredItems.length !== 0 ? <div className="container">
{filteredItems.map((item, index) => (
<div className="box" key={index}>
<div className="upper">
Expand All @@ -72,7 +73,7 @@ function Lecture() {
<a href={item.link}>View Content</a>
</div>
))}
</div>
</div> : <NoResultsFound /> }
</div>
);
}
Expand Down
5 changes: 3 additions & 2 deletions src/components/page5(1st)/fstquantum.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState, useEffect } from 'react';
import NoResultsFound from '../noResultsFound/index.js'
import Header from '../../pages/header.js';
import Aquantum from '../../assets/5th.png';
import Imgphy from '../../assets/physics.webp';
Expand Down Expand Up @@ -66,7 +67,7 @@ function Quantum() {
onChange={(e) => setSearchQuery(e.target.value)}
/>
</div>
<div className="content" style={{ height: "auto" }}>
{ filteredBooks.length !== 0 ? <div className="content" style={{ height: "auto" }}>
{filteredBooks.map(book => (
<div className="book" key={book.title}>
<img src={book.img} alt={book.title} />
Expand All @@ -76,7 +77,7 @@ function Quantum() {
</div>
</div>
))}
</div>
</div> : <NoResultsFound />}
</div>
</div>
);
Expand Down
6 changes: 3 additions & 3 deletions src/components/page6(2nd)/sndlecture.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react';
import Header from '../../pages/header';

import NoResultsFound from '../noResultsFound/index.js'
import Imgmath4 from '../../assets/lmath4.jpg';
import Imgdsa from '../../assets/ldsa.jpg';
import Imgcoa from '../../assets/lcoa.jpg';
Expand Down Expand Up @@ -61,7 +61,7 @@ function SndLecture() {
</div>
<div style={{ margin: '20px' }}>
</div>
<div className="container">
{ filteredLectures.length !== 0 ? <div className="container">
{filteredLectures.map((lecture) => (
<div className="box" key={lecture.title}>
<div className="upper">
Expand All @@ -73,7 +73,7 @@ function SndLecture() {
</a>
</div>
))}
</div>
</div> : <NoResultsFound />}
</div>
);
}
Expand Down
6 changes: 4 additions & 2 deletions src/components/page6(2nd)/sndquantum.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState, useEffect } from 'react';
import NoResultsFound from '../noResultsFound/index.js'
import '../page6(2nd)/sndquantum.css';
import Header from '../../pages/header.js';
import Aquantum from '../../assets/5th.png';
Expand All @@ -14,6 +15,7 @@ import Imguhv from '../../assets/uhv.jpg';
import Imgos from '../../assets/os.jpg';
import Imgtafl from '../../assets/autometa.png';
import {FaMagnifyingGlass } from 'react-icons/fa6'
import { FilterBAndW } from '@mui/icons-material';

const books = [
{ img: Imgmath4, title: "Engineering Math4", file: "Mathematics4" },
Expand Down Expand Up @@ -69,7 +71,7 @@ function SndQuantum() {
onChange={(e) => setSearchQuery(e.target.value)}
/>
</div>
<div className="content" style={{ height: "auto" }}>
{filteredBooks.length !== 0 ? <div className="content" style={{ height: "auto" }}>
{filteredBooks.map(book => (
<div className="book" key={book.title}>
<img src={book.img} alt={book.title} />
Expand All @@ -79,7 +81,7 @@ function SndQuantum() {
</div>
</div>
))}
</div>
</div> : <NoResultsFound />}
</div>
</div>
);
Expand Down
Loading