Skip to content

Commit

Permalink
feat(navbar): Created a subcategory Hacktoberfest under open-source c…
Browse files Browse the repository at this point in the history
…ategory (#2515)
  • Loading branch information
RJPalmer committed Oct 2, 2024
1 parent 8cd94e6 commit 10dd9d4
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 2 deletions.
15 changes: 13 additions & 2 deletions components/SideNavbar/SideNavbarCategory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ export const SideNavbarCategory: FC<{
categoryData: ISidebar;
expand: boolean;
listRef: MutableRefObject<HTMLUListElement | null>;
}> = ({ categoryData, expand, listRef }) => {
updated: boolean;
}> = ({ categoryData, expand, listRef, updated}) => {
const [isOpen, setIsOpen] = useState(expand);
const [hasUpdated, setHasUpdated] = useState(categoryData);
const router = useRouter();
const { category, subcategory } = categoryData;
const sortedSubcategoryList = subcategory
Expand All @@ -49,7 +51,8 @@ export const SideNavbarCategory: FC<{

useEffect(() => {
setIsOpen(expand);
}, [expand]);
// setHasUpdated(categoryData);
}, [expand, categoryData]);

const handleToggle = () => {
setIsOpen(!isOpen);
Expand All @@ -59,6 +62,12 @@ export const SideNavbarCategory: FC<{
setIsOpen(false);
router.replace('/');
};

// const handleUpdate = () => {
// setHasUpdated(!hasUpdated);
// handleUpdate();
// };

useOnClickOutside(listRef, handleClickOutside);

return (
Expand All @@ -69,11 +78,13 @@ export const SideNavbarCategory: FC<{
aria-label={`toggle ${category.toLowerCase()} category`}
href={`/${category}`}
>
{ category === 'open-source' ? 'New' : ''}
<h1
className={`text-slate-500 dark:text-slate-300 text-lg font-sans font-medium w-4/5 truncate ${
category.length < 4 ? 'uppercase' : 'capitalize'
}`}
>
{/* { category === 'open-source' ? '<strong>New' : capitalizeCategory(category)} */}
{capitalizeCategory(category)}
</h1>
<Icons.angleDown
Expand Down
2 changes: 2 additions & 0 deletions components/TopBar/CategoryDescriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ const categoryDescriptions: CategoryDescriptions = {
// Open-source
articles:
'There are many open source blogging platforms available for developers. Some of the most popular ones include WordPress, Joomla, and Drupal1. Other open source blogging platforms include Ghost, Serendipity, SilverStripe, and Jekyll',
hacktoberfest:
'A month-long celebration of open-source projects, their maintainers, and the entire community of contributors.',
projects:
'Anyone can contribute to the projects are called OpenSource Projects. There are many open source projects available for developers. Some of the most popular ones include Linux, Git, and Apache1. Other open source projects include Kubernetes, TensorFlow, and React Native',
tools:
Expand Down
5 changes: 5 additions & 0 deletions database/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ export const sidebarData: ISidebar[] = [
url: '/articles',
resources: DB.openSourceArticles,
},
{
name: 'Hacktoberfest',
url: '/hacktoberfest',
resources: DB.openSourceHacktoberfest,
},
{
name: 'Programs',
url: '/os_programs',
Expand Down
1 change: 1 addition & 0 deletions database/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export { default as tensorflow } from './ai_tools/tensorflow.json'

// Open-source
export { default as openSourceArticles } from './open_source/articles.json'
export { default as openSourceHacktoberfest} from './open_source/hacktoberfest.json'
export { default as openSourcePrograms } from './open_source/os_programs.json'
export { default as openSourceProjects } from './open_source/projects.json'
export { default as openSourceTools } from './open_source/tools.json'
Expand Down
7 changes: 7 additions & 0 deletions database/open_source/hacktoberfest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[{
"name": "Hacktoberfest Official Site",
"description": "Hacktoberfest: a month-long celebration of open-source projects, their maintainers, and the entire community of contributors.",
"url": "https://hacktoberfest.com/",
"category": "open-source",
"subcategory": "hacktoberfest"
}]

0 comments on commit 10dd9d4

Please sign in to comment.