@@ -5,6 +5,8 @@ import { createComponentI18nApi } from "./lib/i18n";
55import { symToStr } from "tsafe/symToStr" ;
66import { cx } from "./lib/tools/cx" ;
77import { FrIconClassName , RiIconClassName } from "./lib/generatedFromCss/classNames" ;
8+ import type { LinkProps } from "./lib/routing" ;
9+ import { useLink } from "./lib/routing" ;
810
911//NOTE: This is a work in progress, this component is not yet usable.
1012
@@ -15,7 +17,7 @@ export type HeaderProps = {
1517 baselinePrécisionsSurLorganisation : ReactNode ;
1618 links : {
1719 text : ReactNode ;
18- href : string ;
20+ linkProps : LinkProps ;
1921 iconId : FrIconClassName | RiIconClassName ;
2022 } [ ] ;
2123} ;
@@ -35,6 +37,8 @@ export function Header(props: HeaderProps) {
3537
3638 const { t } = useTranslation ( ) ;
3739
40+ const { Link } = useLink ( ) ;
41+
3842 return (
3943 < header role = "banner" className = { cx ( fr . cx ( "fr-header" ) , className ) } >
4044 < div /*className={fr.cx("fr-header__body" as any)}*/ >
@@ -75,11 +79,14 @@ export function Header(props: HeaderProps) {
7579 < div className = { fr . cx ( "fr-header__tools" ) } >
7680 < div className = { fr . cx ( "fr-header__tools-links" ) } >
7781 < ul className = { fr . cx ( "fr-btns-group" ) } >
78- { links . map ( ( { href, iconId, text } ) => (
79- < li key = { href + iconId } >
80- < a className = { fr . cx ( "fr-btn" , iconId ) } href = { href } >
82+ { links . map ( ( { linkProps, iconId, text } , i ) => (
83+ < li key = { i } >
84+ < Link
85+ { ...linkProps }
86+ className = { fr . cx ( "fr-btn" , iconId ) }
87+ >
8188 { text }
82- </ a >
89+ </ Link >
8390 </ li >
8491 ) ) }
8592 </ ul >
0 commit comments