|
| 1 | +import { createSignal, FlowProps, onMount } from "solid-js"; |
| 2 | +import { getRequestEvent } from "solid-js/web"; |
| 3 | + |
| 4 | +const Badge = (props: FlowProps) => ( |
| 5 | + <div class="text-base text-white bg-gray-700 rounded-lg px-2 font-medium">{props.children}</div> |
| 6 | +); |
| 7 | + |
| 8 | +const Layout = (props: FlowProps<{ title: string }>) => { |
| 9 | + const [mounted, setMounted] = createSignal(false); |
| 10 | + onMount(() => setMounted(true)); |
| 11 | + |
| 12 | + return ( |
| 13 | + <div class="flex gap-2 flex-col"> |
| 14 | + <div class="flex items-center gap-2 flex-wrap"> |
| 15 | + <h1>{props.title}</h1> |
| 16 | + <Badge>Environment: {import.meta.env.DEV ? "DEV" : "PROD"}</Badge> |
| 17 | + <Badge>Rendered: {!mounted() ? "Server" : "Server & Client"}</Badge> |
| 18 | + </div> |
| 19 | + |
| 20 | + <div class="text-gray-500 text-sm font-medium"> |
| 21 | + Agent:{" "} |
| 22 | + <span class="text-xs"> |
| 23 | + {getRequestEvent()?.request.headers.get("user-agent") ?? navigator.userAgent} |
| 24 | + </span> |
| 25 | + </div> |
| 26 | + |
| 27 | + <ul class="list-inside list-disc mb-4 text-gray-400 font-semibold text-xs"> |
| 28 | + <li> |
| 29 | + Enable throttling & disable cache in the network tab to see eventual frames of unstyled |
| 30 | + content |
| 31 | + </li> |
| 32 | + <li>Click on routes to test client navigation</li> |
| 33 | + </ul> |
| 34 | + |
| 35 | + <div class="grid grid-cols-[repeat(5,auto)] gap-4 gap-y-2"> |
| 36 | + <div class="grid col-span-full grid-cols-subgrid px-4 text-gray-400 text-sm"> |
| 37 | + <div>Component</div> |
| 38 | + <div>File</div> |
| 39 | + <div>Integration</div> |
| 40 | + <div>Lazy</div> |
| 41 | + <div>Comments</div> |
| 42 | + </div> |
| 43 | + |
| 44 | + {props.children} |
| 45 | + </div> |
| 46 | + |
| 47 | + <div class="flex justify-end gap-2 items-center text-sm uppercase font-bold text-white"> |
| 48 | + <div class="grid content-center rounded-lg bg-success px-2">pass</div> |
| 49 | + <div class="grid content-center rounded-lg bg-error px-2">fail</div> |
| 50 | + <div class="grid content-center rounded-lg bg-warn px-2">not supported</div> |
| 51 | + </div> |
| 52 | + </div> |
| 53 | + ); |
| 54 | +}; |
| 55 | + |
| 56 | +export default Layout; |
0 commit comments