-
Notifications
You must be signed in to change notification settings - Fork 417
Expand file tree
/
Copy pathtest.tsx
More file actions
107 lines (103 loc) · 2.75 KB
/
test.tsx
File metadata and controls
107 lines (103 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import { JSX } from "solid-js";
const clsx = (...args: (string | false | undefined)[]) => args.filter(Boolean).join(" ");
const integrations = {
import: "import",
module: "import module",
url: "?url without render",
link: "?url + <link>",
};
const Test = (props: {
invert?: boolean;
class?: string;
component: string;
file: string;
integration?: keyof typeof integrations;
lazy?: boolean;
noSupport?: boolean;
comment?: JSX.Element;
}) => (
<div
class={clsx(
"grid grid-cols-subgrid col-span-full items-center rounded text-white font-medium py-1 px-2 border-4 transition-colors duration-[1.5s]",
props.invert ? "bg-success" : "bg-error",
props.noSupport ? "border-warn" : "border-transparent",
props.class,
)}
>
<div>{props.component}</div>
<div>{props.file}</div>
<div>{integrations[props.integration ?? "import"]}</div>
<div class="font-bold">{props.lazy ? <>✓</> : null}</div>
<div class="text-xs">{props.comment}</div>
</div>
);
export const CommonTests = (props: { routeModuleClass?: string }) => (
<>
<Test
component="Entry Server"
file="entryServer.css"
class="entryServer"
noSupport
comment="Doesn't work at all."
/>
<Test
component="Entry Server"
file="entryServerUrl.css"
class="entryServerUrl"
integration="link"
noSupport
comment="Doesn't work in PROD."
/>
<Test component="Entry Client" file="entryClient.css" class="entryClient" />
<Test component="App" file="app.css" invert />
<Test component="Route" file="route.css" class="route" />
<Test
component="Route"
file="route.module.css"
class={props.routeModuleClass}
integration="module"
/>
<Test
component="Route"
file="url.css"
class="url"
integration="link"
noSupport
comment="FOUC during client-side navigation, on Chrome."
/>
<Test component="Route" file="notRendered.css" class="notRendered" integration="url" invert />
<Test component="Lazy" file="lazy.css" class="lazy" lazy />
<Test
component="LazyGlob"
file="lazyGlob.css"
class="lazyGlob"
lazy
comment={'Imported via "import.meta.glob".'}
/>
<Test
component="LazyLink"
file="lazyLink.css"
class="lazyLink"
integration="link"
lazy
noSupport
comment="FOUC during client-side navigation, on Chrome."
/>
<Test
component="LazyLinkTmp"
file="lazyLinkTmp.css"
class="lazyLinkTmp"
integration="link"
invert
lazy
comment={
<>
Tests fallbacks, only mounted while loading.
<br />
Red while mounted.
</>
}
/>
</>
);
export default Test;