import React, { useId, useMemo, useState } from 'react'; import cx from 'classnames'; import PropTypes from 'prop-types'; import { ChevronLeft } from 'react-bootstrap-icons'; import { NavLink, useLocation } from 'react-router-dom'; import { Collapse } from 'reactstrap'; import Icon from '../../Icon/Icon'; import s from './LinksGroup.module.scss'; const LinksGroup = ({ childrenLinks, className, glyph, header, headerLink }) => { const location = useLocation(); const panelId = useId(); const hasChildren = Boolean(childrenLinks?.length); const isGroupActive = useMemo(() => { if (!headerLink) { return false; } return location.pathname === headerLink || location.pathname.startsWith(`${headerLink}/`); }, [headerLink, location.pathname]); const [isOpen, setIsOpen] = useState(isGroupActive); const panelOpen = isOpen || isGroupActive; if (!hasChildren) { return (