Skip to content

Commit

Permalink
#2249: fix error onclick of breadcrumbs CategoryName
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjeevkumar321 committed Feb 19, 2024
1 parent 23bb9ba commit 2ba1df9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/SideNavbar/SideNavbarCategoryList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const getFilteredCategoryList = (query: string) => {

const matchSearch = (item: SubCategories, query: string) => {
const itemName = item.name.toLowerCase()
const matchingResources = item.resources.filter(
const matchingResources = item.resources?.filter(
(resource: { name: string }) =>
resource.name.toLowerCase().includes(query.toLowerCase())
)
Expand Down
4 changes: 3 additions & 1 deletion components/TopBar/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const TopBar: FC<TopBarProps> = ({}) => {
const { theme } = useTheme()

const category = router.asPath
const categoryKeyName = category?.split('/')[1];
const categoryName = category?.split('/')[1]?.split('-').join(' ')
const subCategoryKeyName = category?.split('/')[2]
const subcategoryName = subCategoryKeyName?.split('-').join(' ')
Expand Down Expand Up @@ -54,7 +55,7 @@ export const TopBar: FC<TopBarProps> = ({}) => {
</Link>
<RxSlash className="hidden md:inline-block" />
<Link
href={'/' + categoryName}
href={'/' + categoryKeyName}
className="bg-[#EDEDED] bg-opacity-20 px-[10px] py-[6px] rounded-md cursor-pointer hidden md:inline-block"
>
<h3>{capitalizeEachWord(categoryName)}</h3>
Expand All @@ -63,6 +64,7 @@ export const TopBar: FC<TopBarProps> = ({}) => {
<Link href={'/' + categoryName} className="flex gap-x-2 items-center">
<IoIosArrowBack className="md:hidden" />
</Link>

<div className="md:bg-[#EDEDED] md:bg-opacity-20 px-[10px] py-[6px] text-xl md:text-base rounded-md truncate ...">
<h3>{capitalizeEachWord(cleanedCategory)}</h3>
</div>
Expand Down

0 comments on commit 2ba1df9

Please sign in to comment.