chore: extract to variable

pull/26374/head
Nicolás Quiroz 2 years ago
parent df653f20e9
commit 5f8fc1c2e1
  1. 4
      src/components/UI/docs/DocsLinks.tsx

@ -51,8 +51,10 @@ export const DocsLinks: FC<Props> = ({ navLinks, toggleMobileAccordion }) => {
{navLinks.map(({ id, to, items }, idx) => { {navLinks.map(({ id, to, items }, idx) => {
const split = to?.split('/'); const split = to?.split('/');
const isActive = slug && split && split[split.length - 1] === slug[slug.length - 1]; const isActive = slug && split && split[split.length - 1] === slug[slug.length - 1];
const isSectionActive = openSections[id];
return ( return (
<Accordion key={id} index={openSections[id] ? 0 : -1} allowToggle mt='0 !important'> <Accordion key={id} index={isSectionActive ? 0 : -1} allowToggle mt='0 !important'>
<AccordionItem border='none'> <AccordionItem border='none'>
{({ isExpanded }) => ( {({ isExpanded }) => (
<> <>

Loading…
Cancel
Save