eno/example/app.tsx

66 lines
1.8 KiB
TypeScript
Raw Normal View History

import React from "react";
2023-04-05 20:05:21 -04:00
import * as Iso from "@eno/iso";
2023-05-13 14:06:28 -04:00
/*
const delay =(inMS:number)=>
{
return new Promise((accept)=>
{
setTimeout(()=>
{
accept({default:()=>
{
return <h1>loooooool</h1>;
}});
}, inMS);
});
}
const LOL = React.lazy(()=>delay(3000));
*/
2023-04-22 12:08:58 -04:00
const Comp = React.lazy(()=>import("./deep/component.tsx"));
2023-05-13 14:06:28 -04:00
export default ()=>
{
2023-05-14 07:26:18 -04:00
const [stack] = React.useContext(Iso.Meta.Context);
return <div class="p-4 font-sans">
2023-05-13 14:06:28 -04:00
<Iso.Meta.Metas title="Main Page!" description="its great"/>
2023-04-22 13:48:32 -04:00
<nav class="p-4">
<a class="text-red-500" href="/">Home</a>
<a href="/about">About</a>
</nav>
<h1 class="my-2 font(bold serif) text(3xl)">Title!!</h1>
2023-04-22 12:08:58 -04:00
<h2>suspended:</h2>
<React.Suspense fallback={<div>Loading!</div>}>
<Comp/>
</React.Suspense>
2023-04-15 12:39:08 -04:00
<Iso.Switch>
<Iso.Case value="/">
<p>thing1</p>
<p>thing2</p>
</Iso.Case>
2023-04-16 21:33:09 -04:00
<Iso.Case value="page">
<Iso.Switch>
2023-04-29 21:15:14 -04:00
<Iso.Case value="about-us">
<>
2023-05-13 14:06:28 -04:00
<Iso.Meta.Metas title="About US" concatListed=" | "/>
2023-04-29 21:15:14 -04:00
About us!
</>
</Iso.Case>
2023-04-16 21:33:09 -04:00
<Iso.Case default>sorry no page</Iso.Case>
</Iso.Switch>
2023-04-15 12:39:08 -04:00
</Iso.Case>
<Iso.Case value="lol/idk">lol/idk</Iso.Case>
2023-05-14 07:26:18 -04:00
<Iso.Case default>
<>
<Iso.Meta.Metas description="a 404 has occurred"/>
<p>404!</p>
</>
</Iso.Case>
2023-04-15 12:39:08 -04:00
</Iso.Switch>
</div>;
2023-04-29 11:15:54 -04:00
};