Skip to content

Commit

Permalink
Merge pull request #874 from iSouvikKhan/feature/ActiveWeek
Browse files Browse the repository at this point in the history
ContentID correction
  • Loading branch information
siinghd authored Aug 14, 2024
2 parents 3747c41 + a2f2ec8 commit 2e590da
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ export function Sidebar({
// if matchArray is not null
if (matchArray) {
const urlPathString = matchArray[1];
currentUrlContentId = Number(
urlPathString.slice(urlPathString.length - 1),
); // get last content id from pathString e.g '/1/2' => 2 (number)
currentUrlContentId = Number(urlPathString.split('/')[1]); // get the content id, e.g '/1/2' => 1 (number)
}
const pathArray = findPathToContent(
fullCourseContent,
Expand Down Expand Up @@ -123,11 +121,10 @@ export function Sidebar({
<Link
key={content.id}
href={navigateToContent(content.id) || '#'}
className={`flex cursor-pointer border-b p-2 hover:bg-gray-200 ${
isActiveContent
? 'bg-gray-300 text-black dark:bg-gray-700 dark:text-white dark:hover:bg-gray-500'
: 'bg-gray-50 text-black dark:bg-gray-800 dark:text-white dark:hover:bg-gray-700'
}`}
className={`flex cursor-pointer border-b p-2 hover:bg-gray-200 ${isActiveContent
? 'bg-gray-300 text-black dark:bg-gray-700 dark:text-white dark:hover:bg-gray-500'
: 'bg-gray-50 text-black dark:bg-gray-800 dark:text-white dark:hover:bg-gray-700'
}`}
>
<div className="flex w-full justify-between">
<div className="flex">
Expand Down Expand Up @@ -192,14 +189,12 @@ export function ToggleButton({
className={`block h-0.5 w-6 rounded-sm bg-black transition-all duration-300 ease-out dark:bg-white ${!sidebarOpen ? 'translate-y-1 rotate-45' : '-translate-y-0.5'}`}
></span>
<span
className={`my-0.5 block h-0.5 w-6 rounded-sm bg-black transition-all duration-300 ease-out dark:bg-white ${
!sidebarOpen ? 'opacity-0' : 'opacity-100'
}`}
className={`my-0.5 block h-0.5 w-6 rounded-sm bg-black transition-all duration-300 ease-out dark:bg-white ${!sidebarOpen ? 'opacity-0' : 'opacity-100'
}`}
></span>
<span
className={`block h-0.5 w-6 rounded-sm bg-black transition-all duration-300 ease-out dark:bg-white ${
!sidebarOpen ? '-translate-y-1 -rotate-45' : 'translate-y-0.5'
}`}
className={`block h-0.5 w-6 rounded-sm bg-black transition-all duration-300 ease-out dark:bg-white ${!sidebarOpen ? '-translate-y-1 -rotate-45' : 'translate-y-0.5'
}`}
></span>
</button>
);
Expand Down

0 comments on commit 2e590da

Please sign in to comment.