forked from rupali-codes/LinksHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "fix bug: search query overlaps search result" (rupali-codes#1293
- Loading branch information
1 parent
03635aa
commit 22fa331
Showing
6 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
type CategoryDescriptions = { | ||
[key: string]: string | ||
} | ||
|
||
const categoryDescriptions: CategoryDescriptions = { | ||
//frontend | ||
accessibility: 'Accessibility category description', | ||
animations: 'Animations category description', | ||
colors: 'Colors category description', | ||
'design inspiration': 'Design Inspiration category description', | ||
fonts: 'Fonts category description', | ||
icons: 'Icons category description', | ||
illustrations: 'Illustrations category description', | ||
images: 'Images category description', | ||
onlineCodeEditors: 'Online Code Editors category description', | ||
react: 'React category description', | ||
'themes templates': 'Themes and Templates category description', | ||
'ui generator': 'UI Generators category description', | ||
videos: 'Videos Category description', | ||
//backend | ||
architecture: 'Architecture category description', | ||
authentication: 'Authentication category description', | ||
caching: 'Caching category description', | ||
database: 'Database category description', | ||
security: 'Security category description', | ||
'system design': 'System Design category description', | ||
testing: 'Testing category description', | ||
validation: 'Validation category description', | ||
// languages | ||
'c programming': 'CProgramming category description', | ||
csharp: 'csharp category description', | ||
golang: 'Golang category description', | ||
javascript: 'JavaScript category description', | ||
python: 'Python category description', | ||
ruby: 'ruby category description', | ||
typescript: 'typescript category description', | ||
// ml & ai | ||
'data science': 'Data Science category description', | ||
'deep learning': 'Deep Learning category description', | ||
'machine-learning': 'ML category description', | ||
// Open-source | ||
openSourceBlogs: 'Open Source Blogs category description', | ||
openSourceProjects: 'Open Source Projects category description', | ||
openSourceTools: 'Open Source Tools category description', | ||
// resources | ||
blogs: 'Blogs category description', | ||
ebook: 'E-Book category description', | ||
hosting: 'Hosting category description', | ||
officialdocs: 'Official Docs category description', | ||
'project ideas': 'Project category description', | ||
// youtube | ||
android: 'Android category description', | ||
'competitive programming': 'Competitive Programming category description', | ||
'computer science': 'Computer Science category description', | ||
css: 'CSS category description', | ||
'data structures': 'Data Structures category description', | ||
fintech: 'Fintech category description', | ||
'game development': 'Game Development category description', | ||
'machine learning': 'Machine Learning category description', | ||
tensorflow: 'TensorFlow category description', | ||
youtubeTesting: 'Youtube Testing category description', | ||
'web development': 'Web Development category description', | ||
'web3 metaverse': 'Web3 Metaverse category description', | ||
// other | ||
communities: 'Communities category description', | ||
devtools: 'DevTools category description', | ||
github: 'GitHub category description', | ||
'other resources': 'Other Resources category description', | ||
podcasts: 'Podcasts category description', | ||
} | ||
|
||
export default categoryDescriptions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { FC, useState } from 'react' | ||
import { useRouter } from 'next/router' | ||
import { FaSlackHash, FaInfoCircle } from 'react-icons/fa' | ||
import PopupDesc from 'components/popup/popupCategoryDesc' | ||
import { ICategoryData } from 'types' | ||
import categoryDescriptions from './CategoryDescriptions' | ||
|
||
export const TopBar: FC<{ className?: string | undefined }> = (props) => { | ||
const { className } = props | ||
const [currentCategory, setCurrentCategory] = useState<ICategoryData | null>( | ||
null | ||
) | ||
const router = useRouter() | ||
const category = router.asPath.replace('/', '') | ||
const categoryName = category.split('-').join(' ') | ||
|
||
if (router.pathname.length === 1) { | ||
return null | ||
} | ||
|
||
const handleCardClick = () => { | ||
const description = categoryDescriptions[categoryName] || '' | ||
const categoryInfo = { | ||
name: categoryName, | ||
description, | ||
} | ||
setCurrentCategory(categoryInfo) | ||
} | ||
|
||
const removeCurrentCard = () => { | ||
setCurrentCategory(null) | ||
} | ||
|
||
return ( | ||
<div | ||
className={`flex items-center text-xl dark:text-gray-300 ${className}`} | ||
> | ||
<FaSlackHash className="mr-2 text-gray-600 dark:text-gray-300" /> | ||
<span className="flex uppercase text-gray-900 dark:text-gray-100"> | ||
{category.split('-').join(' ')} | ||
<FaInfoCircle | ||
className="ml-4 mt-2 text-sm cursor-pointer" | ||
onClick={handleCardClick} | ||
/> | ||
<PopupDesc | ||
currentCategory={currentCategory} | ||
onClose={removeCurrentCard} | ||
/> | ||
</span> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import { TopBar } from './TopBar' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters