mirror of
https://github.com/immich-app/immich.git
synced 2025-03-18 02:31:28 -05:00
feat(docs): highlight active version in version switcher (#16790)
* docs: highlight active version in version switcher * Add comment explaining workaround
This commit is contained in:
parent
48dddb78d4
commit
f0f0056fe3
1 changed files with 3 additions and 2 deletions
|
@ -4,7 +4,7 @@ import React, { useEffect, useState } from 'react';
|
|||
|
||||
export default function VersionSwitcher(): JSX.Element {
|
||||
const [versions, setVersions] = useState([]);
|
||||
const [label, setLabel] = useState('Versions');
|
||||
const [activeLabel, setLabel] = useState('Versions');
|
||||
|
||||
const windowSize = useWindowSize();
|
||||
|
||||
|
@ -48,12 +48,13 @@ export default function VersionSwitcher(): JSX.Element {
|
|||
versions.length > 0 && (
|
||||
<DropdownNavbarItem
|
||||
className="version-switcher-34ab39"
|
||||
label={label}
|
||||
label={activeLabel}
|
||||
mobile={windowSize === 'mobile'}
|
||||
items={versions.map(({ label, url }) => ({
|
||||
label,
|
||||
to: new URL(location.pathname + location.search + location.hash, url).href,
|
||||
target: '_self',
|
||||
className: label === activeLabel ? 'dropdown__link--active menu__link--active' : '', // workaround because React Router `<NavLink>` only supports using URL path for checking if active: https://v5.reactrouter.com/web/api/NavLink/isactive-func
|
||||
}))}
|
||||
/>
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue