-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
02c523f
commit 3f15f38
Showing
9 changed files
with
36 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import { kll } from '../main.js' | ||
import { displayReturnBtn } from '../utils/displayReturnBtn.js' | ||
|
||
export const link = { | ||
onClick(_, el, e) { | ||
async onClick(_, el, e) { | ||
e.preventDefault() | ||
const path = el.getAttribute('href') | ||
window.history.pushState({}, '', path) | ||
kll.injectPage(path) | ||
await kll.injectPage(path) | ||
displayReturnBtn() | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
<template id="sections"> | ||
<div class="flex gap-3 flex-wrap mx-auto min-w-[50dvw] max-w-[800px]"> | ||
<div kll-tc="returnButton" class="w-full"></div> | ||
</div> | ||
<div class="flex gap-3 flex-wrap mx-auto min-w-[50dvw] max-w-[800px]"></div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { kll } from '../main' | ||
|
||
export function displayReturnBtn() { | ||
const returnButtonEl = document.querySelector('#return_button') | ||
if (!returnButtonEl) return | ||
const { route } = kll.parseRoute() | ||
|
||
if (route.match(/category|ressource/)) | ||
returnButtonEl.classList.remove('hidden') | ||
else returnButtonEl.classList.add('hidden') | ||
} |