Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
zakarialaoui10 committed Oct 11, 2024
1 parent 9293533 commit 6f556f7
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 11 deletions.
49 changes: 49 additions & 0 deletions preview/__main2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// globalThis.S=SPA({
// target : document.querySelector("#app"),
// wrapper : Section().style({
// display : "flex",
// justifyContent: "center",
// alignItems : "center",
// height : "100vh"
// }),
// routes:{
// "/":()=>text("Hello world"),
// "/id/:id":async ({id})=>{
// let resp = await fetch(`https://jsonplaceholder.typicode.com/todos/${id}`)
// let data = await resp.json()
// return Flex(
// text(data.title)
// )
// },
// "/users/:user":async ({user})=>{
// let resp = await fetch(`https://api.github.com/users/${user}`)
// const {name,followers,public_repos, avatar_url}= await resp.json()
// // console.log({name, followers, public_repos, avatar_url})
// useTitle(name)
// useFavIcon(avatar_url)
// const Card = Flex(
// text(name).style({
// color : "darkblue",
// fontSize : "1.4rem",
// border : "2px darkblue solid",
// padding : "10px",
// background:"tomato"
// }),
// image(avatar_url).size("200px","auto").style({outline : "2px darkblue solid"}),
// Flex(
// text(`N° followers : ${followers}`),
// text(`N° repos : ${public_repos}`)
// ).horizontal("space-around",0).size("80%","auto").style({
// color : "darkblue",
// border : "2px darkblue solid",
// padding : "10px",
// background:"tomato"
// })
// ).size("400px","400px").vertical(0,"space-around").style({
// border : "2px darkblue solid",
// background : "coral"
// })
// return Card
// },
// }
// })
13 changes: 13 additions & 0 deletions preview/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,21 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
<link
href="https://fonts.googleapis.com/css?family=Gloria+Hallelujah&display=swap"
rel="stylesheet"
/>
<!-- <style>
body{
font-family: "Gloria Hallelujah", cursive;
font-weight: 700;
text-wrap :wrap !important;
overflow-x: hidden;
}
</style> -->
</head>
<body>
<script type="module" src="/main.js"></script>
<div id="app"></div>
</body>
</html>
13 changes: 2 additions & 11 deletions preview/main.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,2 @@
import {Section,SPA, text} from "ziko"
__Ziko__.__Config__.default.target = document.body
const main=Section()
const p1=Section()
const p2=Section()
let S=SPA(
main,{
"/":text("Hi"),
"/page1":text("p1"),
"/page2":text("p2")
})
import { FileBasedRouting } from "ziko";
FileBasedRouting(import.meta.glob('./src/pages/**/*.js'))
3 changes: 3 additions & 0 deletions preview/src/pages/[blog]/[lang]/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default ({blog,lang})=>{
console.log({blog,lang})
}
3 changes: 3 additions & 0 deletions preview/src/pages/[blog]/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default (params)=>{
console.log(params)
}
6 changes: 6 additions & 0 deletions preview/src/pages/about.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { p } from "ziko"
export default ()=>{
return p("About ").style({
color:"red",
})
}
6 changes: 6 additions & 0 deletions preview/src/pages/articles/[data]/[color]/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { text } from "ziko";
export default ({data,color})=>{
return text(data).style({
color : color
})
}
6 changes: 6 additions & 0 deletions preview/src/pages/articles/a1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { p } from "ziko"
export default ()=>{
return p("Bla bla bla ").style({
color:"red",
})
}
20 changes: 20 additions & 0 deletions preview/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { p,App,Flex } from "ziko"

const {QueryParams} = __Ziko__
export default ()=>{
return App({
head : {
title : "ziko",
},
wrapper : ()=>Flex(p("Hello world").style({
color : QueryParams.color ?? "black"
})).size("100vw","100vh").vertical(0,0)
})
}
document.body.style.overflow = "hidden"
// export default ()=>{
// return p("Hello from zikojs File based routing ").style({
// color:"red",
// fontFamily : "Gloria Hallelujah"
// })
// }
3 changes: 3 additions & 0 deletions preview/src/pages/me.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default ()=>{
console.log("me")
}

0 comments on commit 6f556f7

Please sign in to comment.