small update before zzz

This commit is contained in:
Zoe
2022-09-27 22:59:31 -05:00
parent 2040570ea2
commit 76f93f24e3
4 changed files with 7 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
export const RouterLink = (link: string, name: string) => {
return `
<a href="#" d-click="event.preventDefault(); loadPage('${link}')">${name}</a>
<a href="${link}" d-click="event.preventDefault(); loadPage('${link}')">${name}</a>
`
}

View File

@@ -38,6 +38,7 @@ async function loadPage(route?: string) {
const file = await import(/* @vite-ignore */ './pages' + fileName)
templatedVirtualDom = await eval(compileToString(eval(file.default)()))
}
console.log
documentBody.innerHTML = templatedVirtualDom
// here we hydrate/re-hydrate the page content
await hydratePage()

View File

@@ -7,7 +7,7 @@ export default () => {
<div class="p-6 border-neutral-800 rounded-lg container__content border">
${Counter()}
<div class="flex gap-1 justify-center">
reutrn ${RouterLink('/', 'Home')}
go ${RouterLink('/subroute/deep/deeper/deepest', 'deeper')}
</div>
</div>
</div>

View File

@@ -10,7 +10,10 @@ body {
padding: 0;
margin: 0;
min-height: 100vh;
scrollbar-color: #27272a #27272a;
}
a:hover {
text-decoration: underline;
}
.container__content {