Skip to content

Commit

Permalink
updates routeIn function
Browse files Browse the repository at this point in the history
  • Loading branch information
luis687687 committed Jul 6, 2024
1 parent 309f9b1 commit b7b656d
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 3 deletions.
8 changes: 6 additions & 2 deletions routes/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Rosaura from "../rosaura/rozaura/index.js"
import Page1 from "../src/Pages/Page1/index.js"
import Page2 from "../src/Pages/Page2/index.js"
import Teste from "../src/Pages/Teste/index.js"
import Teste2 from "../src/Pages/Teste2/index.js"

export default () => {

Expand All @@ -13,11 +15,13 @@ export default () => {
{
routes: [
{element: Page1, path: "/page1", attributes: {}},
{element: Page2, path: "/page2", attributes: {}}
{element: Page2, path: "/page2", attributes: {}},
{element: Teste, path: "/teste", attributes: {}},
{element: Teste2, path: "/teste2", attributes: {}}
]
}
)

)
)
}
}
3 changes: 2 additions & 1 deletion src/Components/Card/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
}
.card{
transition: 0.5s;
}
user-select: none !important;
}
13 changes: 13 additions & 0 deletions src/Components/screenMonitor/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defVariable } from "../../../rosaura/rozaura/index.js"

export default props => {

const [value, setValue] = defVariable();

window.onresize = () => {

setValue(window.innerWidth)
}

return value;
}
47 changes: 47 additions & 0 deletions src/Pages/Teste/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { BuildComponent, defVariable, routeIn, varMonitor, varPrint } from "../../../rosaura/rozaura/index.js"
import screenMonitor from "../../Components/screenMonitor/index.js";

export default ({routerref}) => {


const [mensagem, setMensagem] = defVariable("Luis")

var c = 0;

routeIn( (objecto) => {
const {params} = objecto
console.log(params)
setMensagem(params.luis)

}, {routerref})

const scr = screenMonitor()

varMonitor( () => {

console.log("Mudou o screen ", scr.value)
}, [scr])


return(
BuildComponent({
childElements: [
BuildComponent({
text: varPrint("Rota /teste : {} ", [mensagem]),
type: 'h1'
}),
BuildComponent( {
type: "a",
text: 'ir para outra',
attributes: {
href: '/teste2'
}
})
],
style: {
alignItems: "center",
justifyContent: 'center'
}
})
)
}
44 changes: 44 additions & 0 deletions src/Pages/Teste2/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { BuildComponent, defVariable, routeIn, varPrint } from "../../../rosaura/rozaura/index.js"

export default ({routerref}) => {


const [mensagem, setMensagem] = defVariable("Luis")

var c = 0;

routeIn( (objecto) => {
const {params} = objecto
console.log(params)
setMensagem(params.luis)
window.onresize = () => {

console.log(" Resized from route /teste2", window.innerWidth)
}

}, {routerref})



return(
BuildComponent({
childElements: [
BuildComponent({
text: varPrint("Valor do parâmetro: {} ", [mensagem]),
type: 'h1'
}),
BuildComponent( {
type: "a",
text: 'ir para outra',
attributes: {
href: '/teste'
}
})
],
style: {
alignItems: "center",
justifyContent: 'center'
}
})
)
}

0 comments on commit b7b656d

Please sign in to comment.