|
|
|
|
@ -50,6 +50,8 @@ export function Header({items = []}) {
|
|
|
|
|
return (
|
|
|
|
|
<a href={item.url}
|
|
|
|
|
target={item.target}
|
|
|
|
|
title={"Accédez à la page " + item.title}
|
|
|
|
|
aria-label={"Accédez à la page " + item.title}
|
|
|
|
|
className={"text-gray-900 hover:text-blue-600 dark:text-gray-400 dark:hover:bg-transparent dark:hover:text-gray-500 " + (isActive ? 'text-blue-600 dark:text-gray-500' : '') + " block py-2 pl-3 pr-4 border-b border-gray-100 hover:bg-gray-50 md:hover:bg-transparent md:border-0 md:p-0"}
|
|
|
|
|
aria-current="page">{item.title}</a>
|
|
|
|
|
)
|
|
|
|
|
@ -60,6 +62,8 @@ export function Header({items = []}) {
|
|
|
|
|
return (
|
|
|
|
|
<li key={value.title + index}>
|
|
|
|
|
<a href={value.url}
|
|
|
|
|
title={"Accédez à la page " + value.title}
|
|
|
|
|
aria-label={"Accédez à la page " + value.title}
|
|
|
|
|
className="text-gray-900 dark:text-gray-400 hover:text-blue-600 dark:hover:text-gray-500">
|
|
|
|
|
{value.title}
|
|
|
|
|
</a>
|
|
|
|
|
@ -86,7 +90,8 @@ export function Header({items = []}) {
|
|
|
|
|
<div id="menu-dropdown"
|
|
|
|
|
className="absolute z-10 grid hidden w-auto text-sm bg-white border border-gray-100 rounded-lg shadow-md dark:border-gray-700 dark:bg-gray-700">
|
|
|
|
|
<div className="p-4 pb-0 text-gray-900 md:pb-4 dark:text-white">
|
|
|
|
|
<ul className="space-y-4" aria-labelledby="mega-menu-dropdown-button">
|
|
|
|
|
<ul className="space-y-4"
|
|
|
|
|
aria-labelledby="mega-menu-dropdown-button">
|
|
|
|
|
{item.children.data.map((children, index) => renderRegularDropdownItem(children, index))}
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
@ -99,17 +104,21 @@ export function Header({items = []}) {
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<a href="/sign-in"
|
|
|
|
|
title="Page de connexion"
|
|
|
|
|
aria-label="Page de connexion"
|
|
|
|
|
className="text-gray-800 dark:text-white hover:bg-gray-50 focus:ring-4 focus:ring-gray-300 font-medium rounded-lg text-sm px-4 py-2 md:px-5 md:py-2.5 mr-1 md:mr-2 dark:hover:bg-gray-700 focus:outline-none dark:focus:ring-gray-800">
|
|
|
|
|
<span className="hidden lg:block">Connexion</span>
|
|
|
|
|
<span className="block lg:hidden">
|
|
|
|
|
<FontAwesomeIcon icon={faRightToBracket}/>
|
|
|
|
|
<FontAwesomeIcon icon={faRightToBracket} />
|
|
|
|
|
</span>
|
|
|
|
|
</a>
|
|
|
|
|
<a href="/sign-up"
|
|
|
|
|
title="Page d'inscription"
|
|
|
|
|
aria-label="Page d'inscription"
|
|
|
|
|
className="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 md:px-5 md:py-2.5 mr-1 md:mr-2 dark:bg-dark-600 dark:hover:bg-dark-500 focus:outline-none dark:focus:ring-blue-800">
|
|
|
|
|
<span className="hidden lg:block">Inscription</span>
|
|
|
|
|
<span className="block lg:hidden">
|
|
|
|
|
<FontAwesomeIcon icon={faUserPlus}/>
|
|
|
|
|
<FontAwesomeIcon icon={faUserPlus} />
|
|
|
|
|
</span>
|
|
|
|
|
</a>
|
|
|
|
|
</>
|
|
|
|
|
@ -120,14 +129,16 @@ export function Header({items = []}) {
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<button type="button"
|
|
|
|
|
role="button"
|
|
|
|
|
className="flex mr-3 text-sm bg-gray-800 rounded-full md:mr-0 focus:ring-4 focus:ring-gray-300 dark:focus:ring-gray-600"
|
|
|
|
|
id="user-menu-button"
|
|
|
|
|
aria-label="Options de l'utilisateur"
|
|
|
|
|
aria-expanded="false"
|
|
|
|
|
data-dropdown-placement="bottom">
|
|
|
|
|
<span className="sr-only">Open user menu</span>
|
|
|
|
|
<span className="sr-only">Options de l'utilisateur</span>
|
|
|
|
|
<img className="w-8 h-8 rounded-full"
|
|
|
|
|
src={hasAvatar((session.user as any)) ? getBackendImg((session.user as any).avatar.formats.thumbnail.url) : siteConfig.defaultUserAvatar}
|
|
|
|
|
alt="user photo"/>
|
|
|
|
|
alt="user photo" />
|
|
|
|
|
</button>
|
|
|
|
|
<div
|
|
|
|
|
className="z-50 hidden my-4 text-base list-none bg-white divide-y divide-gray-100 rounded shadow dark:bg-gray-700 dark:divide-gray-600"
|
|
|
|
|
@ -137,31 +148,40 @@ export function Header({items = []}) {
|
|
|
|
|
<span
|
|
|
|
|
className="block text-sm font-medium text-gray-500 truncate dark:text-gray-400">{session.user.email}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<ul className="py-1" aria-labelledby="user-menu-button">
|
|
|
|
|
<ul className="py-1"
|
|
|
|
|
aria-labelledby="user-menu-button">
|
|
|
|
|
<li>
|
|
|
|
|
<a href="#"
|
|
|
|
|
aria-label="Profile"
|
|
|
|
|
title="Profile"
|
|
|
|
|
className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white">
|
|
|
|
|
Dashboard
|
|
|
|
|
Profile
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<a href="#"
|
|
|
|
|
aria-label="Paramètres"
|
|
|
|
|
title="Paramètres"
|
|
|
|
|
className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white">
|
|
|
|
|
Settings
|
|
|
|
|
Paramètres
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<a href="#"
|
|
|
|
|
aria-label="Mes cours"
|
|
|
|
|
title="Mes cours"
|
|
|
|
|
className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white">
|
|
|
|
|
Earnings
|
|
|
|
|
Mes cours
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<a href="#"
|
|
|
|
|
title="Dconnexion"
|
|
|
|
|
aria-label="Dconnexion"
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
onClick={signOut}
|
|
|
|
|
className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white">
|
|
|
|
|
Sign out
|
|
|
|
|
Déconnexion
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
@ -179,25 +199,42 @@ export function Header({items = []}) {
|
|
|
|
|
className="bg-white dark:bg-gray-800 w-full md:w-auto p-2 md:p-4"
|
|
|
|
|
id="navbar-default">
|
|
|
|
|
<div className="container max-w-screen-xl flex flex-wrap items-center justify-between mx-auto">
|
|
|
|
|
<a href="/" className="flex items-center">
|
|
|
|
|
<img src="https://flowbite.com/docs/images/logo.svg" className="h-6 mr-3 sm:h-9" alt="Flowbite Logo"/>
|
|
|
|
|
<a href="/"
|
|
|
|
|
aria-label="Page d'accueil MeCP"
|
|
|
|
|
title="Page d'accueil MeCP"
|
|
|
|
|
className="flex items-center">
|
|
|
|
|
<img src="https://flowbite.com/docs/images/logo.svg"
|
|
|
|
|
className="h-6 mr-3 sm:h-9"
|
|
|
|
|
height="auto"
|
|
|
|
|
width="auto"
|
|
|
|
|
alt="Flowbite Logo" />
|
|
|
|
|
<span className="self-center text-xl font-semibold whitespace-nowrap dark:text-white">MeCP</span>
|
|
|
|
|
</a>
|
|
|
|
|
<div className="flex items-center">
|
|
|
|
|
<button
|
|
|
|
|
id="shop-panel-button"
|
|
|
|
|
name="shop-panel-button"
|
|
|
|
|
aria-label="Accéder au panier d'achat"
|
|
|
|
|
role="button"
|
|
|
|
|
type="button"
|
|
|
|
|
className="text-gray-700 border border-transparent hover:bg-gray-200 hover:text-white focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm p-2.5 text-center inline-flex items-center mr-2 dark:text-blue-500 dark:hover:text-white dark:focus:ring-blue-800">
|
|
|
|
|
<FontAwesomeIcon icon={faBagShopping}/>
|
|
|
|
|
<FontAwesomeIcon icon={faBagShopping} />
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
{session ? renderConnectedUser() : renderAnonymousUser()}
|
|
|
|
|
|
|
|
|
|
<button id="menu-button"
|
|
|
|
|
type="button"
|
|
|
|
|
role="navigation"
|
|
|
|
|
className="inline-flex items-center p-2 text-sm text-gray-500 rounded-lg md:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600"
|
|
|
|
|
aria-label="Déplier le menu"
|
|
|
|
|
aria-controls="navbar-dropdown"
|
|
|
|
|
aria-expanded="false">
|
|
|
|
|
<span className="sr-only">Open main menu</span>
|
|
|
|
|
<svg className="w-6 h-6" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20"
|
|
|
|
|
<svg className="w-6 h-6"
|
|
|
|
|
aria-hidden="true"
|
|
|
|
|
fill="currentColor"
|
|
|
|
|
viewBox="0 0 20 20"
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg">
|
|
|
|
|
<path fillRule="evenodd"
|
|
|
|
|
d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z"
|
|
|
|
|
@ -207,15 +244,16 @@ export function Header({items = []}) {
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
<hr className="border-gray-100 dark:border-gray-700 container max-w-screen-xl mx-auto"/>
|
|
|
|
|
<section className="hidden w-full md:block md:w-auto" id="navbar-dropdown">
|
|
|
|
|
<hr className="border-gray-100 dark:border-gray-700 container max-w-screen-xl mx-auto" />
|
|
|
|
|
<section className="hidden w-full md:block md:w-auto"
|
|
|
|
|
id="navbar-dropdown">
|
|
|
|
|
<div className="container max-w-screen-xl mx-auto">
|
|
|
|
|
<ul className="flex flex-col md:p-4 font-medium md:flex-row md:space-x-8 md:mt-0">
|
|
|
|
|
{items.map((item, index: number) => renderGenerateItem(item, index))}
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
<hr className="border-gray-100 sm:mx-auto dark:border-gray-700"/>
|
|
|
|
|
<hr className="border-gray-100 sm:mx-auto dark:border-gray-700" />
|
|
|
|
|
</main>
|
|
|
|
|
</div>
|
|
|
|
|
</nav>
|
|
|
|
|
|