Switch to single page application #2

Merged
array-in-a-matrix merged 8 commits from hpx-spa into main 2024-01-08 21:04:02 -05:00
5 changed files with 44 additions and 10 deletions
Showing only changes of commit 41922dd2cd - Show all commits

View file

@ -0,0 +1,12 @@
# Import HappyX
import happyx
# Declare component
component Content:
# Declare HTML template
`template`:
tDiv(class = "p-10"):
"read"
`script`:
echo "Start coding!"

13
src/components/index.nim Normal file
View file

@ -0,0 +1,13 @@
# Import HappyX
import happyx
# Declare component
component Index:
# Declare HTML template
`template`:
tDiv(class = "p-10"):
tH1():
"Blog in a Matrix"
`script`:
echo "Start coding!"

View file

@ -6,8 +6,14 @@ import happyx
component Nav:
# Declare HTML template
`template`:
# tDiv(class = "", id=""):
tNav(class="nav"):
"Hello, world!"
`script`:
echo "Start coding!"
tNav(class="bg-black w-48 text-white text-center"):
tDiv():
"Title"
tA():
"button"
tA():
"button"
tA():
"button"
tA():
"button"

View file

@ -6,7 +6,7 @@
</head>
<body>
<div id="app"></div>
<div id="app" class="relative min-h-screen flex"></div>
<script src="main.js"></script>
</body>
</html>

View file

@ -2,10 +2,13 @@
import
happyx,
path_params,
components/[navigation]
components/[navigation, index, content]
# Declare application with ID "app"
appRoutes("app"):
"/":
# Component usage
component Nav
component Nav
component Index
"/read":
component Nav
component Content