mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 19:49:01 +01:00 
			
		
		
		
	fix(website/i18n): header link not indicating active
This commit is contained in:
		
							parent
							
								
									be5e70130c
								
							
						
					
					
						commit
						f29411baf7
					
				| @ -10,6 +10,7 @@ import logoPath from "../assets/icon-color.svg"; | |||||||
| import menuIcon from "../assets/boxicons/bx-menu.svg?raw"; | import menuIcon from "../assets/boxicons/bx-menu.svg?raw"; | ||||||
| import { LocaleContext } from ".."; | import { LocaleContext } from ".."; | ||||||
| import { useTranslation } from "react-i18next"; | import { useTranslation } from "react-i18next"; | ||||||
|  | import { swapLocaleInUrl } from "../i18n"; | ||||||
| 
 | 
 | ||||||
| interface HeaderLink { | interface HeaderLink { | ||||||
|     url: string; |     url: string; | ||||||
| @ -53,16 +54,17 @@ export function Header(props: {repoStargazersCount: number}) { | |||||||
|                 </div> |                 </div> | ||||||
| 
 | 
 | ||||||
|                 <nav className={`${mobileMenuShown ? "mobile-shown" : ""}`}> |                 <nav className={`${mobileMenuShown ? "mobile-shown" : ""}`}> | ||||||
|                     {headerLinks.map(link => ( |                     {headerLinks.map(link => { | ||||||
|                         <Link |                         const linkHref = link.external ? link.url : swapLocaleInUrl(link.url, locale); | ||||||
|                             href={link.external ? link.url : `/${locale}${link.url}`} |                         return (<Link | ||||||
|                             className={url === link.url ? "active" : ""} |                             href={linkHref} | ||||||
|  |                             className={url === linkHref ? "active" : ""} | ||||||
|                             openExternally={link.external} |                             openExternally={link.external} | ||||||
|                             onClick={() => { |                             onClick={() => { | ||||||
|                                 setMobileMenuShown(false); |                                 setMobileMenuShown(false); | ||||||
|                             }} |                             }} | ||||||
|                         >{link.text}</Link> |                         >{link.text}</Link>) | ||||||
|                     ))} |                     })} | ||||||
| 
 | 
 | ||||||
|                     <SocialButtons className="mobile-only" withText /> |                     <SocialButtons className="mobile-only" withText /> | ||||||
|                 </nav> |                 </nav> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran