Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
deniseli committed Aug 28, 2024
1 parent 34ee0b8 commit d743dd6
Showing 1 changed file with 24 additions and 29 deletions.
53 changes: 24 additions & 29 deletions frontend/src/features/modules/ModulesTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,37 +72,32 @@ const ModuleSection = ({
const navigate = useNavigate()
return (
<li key={module.name} id={`module-tree-module-${module.name}`} className='my-2'>
{module.decls.length === 0 ? (
<a href={`${path}?${params}`} className='hover:bg-gray-100 hover:dark:bg-gray-700 group flex gap-x-3 rounded-md px-2 text-sm font-medium leading-6'>
<BookOpenIcon aria-hidden='true' className='size-3 shrink-0' />
<Disclosure as='div' defaultOpen={isExpanded}>
<DisclosureButton
className='hover:bg-gray-100 hover:dark:bg-gray-700 group flex w-full modules-center gap-x-2 space-y-1 rounded-md px-2 text-left text-sm font-medium leading-6'
onClick={() => toggleExpansion(module.name)}
>
<BookOpenIcon aria-hidden='true' className='size-4 my-1 shrink-0 ' />
{module.name}
</a>
) : (
<Disclosure as='div' defaultOpen={isExpanded}>
<DisclosureButton
className='hover:bg-gray-100 hover:dark:bg-gray-700 group flex w-full modules-center gap-x-2 space-y-1 rounded-md px-2 text-left text-sm font-medium leading-6'
onClick={() => toggleExpansion(module.name)}
>
<BookOpenIcon aria-hidden='true' className='size-4 my-1 shrink-0 ' />
{module.name}
<ArrowRightCircleIcon
aria-hidden='true'
className='size-4 shrink-0 rounded-md hover:bg-gray-200 dark:hover:bg-gray-600'
onClick={(e) => {
e.preventDefault()
e.stopPropagation()
navigate(`${path}?${params}`)
}}
/>
<ArrowRightCircleIcon
aria-hidden='true'
className='size-4 shrink-0 rounded-md hover:bg-gray-200 dark:hover:bg-gray-600'
onClick={(e) => {
e.preventDefault()
e.stopPropagation()
navigate(`${path}?${params}`)
}}
/>
{module.decls.length === 0 || (
<ChevronRightIcon aria-hidden='true' className='ml-auto h-4 w-4 shrink-0 group-data-[open]:rotate-90 group-data-[open]:text-gray-500' />
</DisclosureButton>
<DisclosurePanel as='ul' className='px-2'>
{module.decls.map((d, i) => (
<DeclNode key={i} decl={d} href={`${path}/${d.value.case}/${d.value.value?.name}?${params}`} />
))}
</DisclosurePanel>
</Disclosure>
)}
)}
</DisclosureButton>
<DisclosurePanel as='ul' className='px-2'>
{module.decls.map((d, i) => (
<DeclNode key={i} decl={d} href={`${path}/${d.value.case}/${d.value.value?.name}?${params}`} />
))}
</DisclosurePanel>
</Disclosure>
</li>
)
}
Expand Down

0 comments on commit d743dd6

Please sign in to comment.