-
Notifications
You must be signed in to change notification settings - Fork 588
/
Copy pathhomepage.lite.tsx
88 lines (74 loc) · 2.65 KB
/
homepage.lite.tsx
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
import { For, onMount, Show, useStore } from '@builder.io/mitosis';
import { COMPONENT_PATHS } from './component-paths';
import ComponentOnUpdate from './components/component-on-update.lite';
import DefaultProps from './components/default-props/use-default-props.lite';
import DisabledInput from './components/disabled-input/disabled-input.lite';
import NestedParent from './components/nested/nested-parent.lite';
import OneComponent from './components/one-component.lite';
import ShowForComponent from './components/show-for-component.lite';
import SignalParent from './components/signals/signal-parent.lite';
import SpecialTags from './components/special-tags.lite';
import ComponentWithInsideTypes from './components/types/component-with-inside-types.lite';
import ComponentWithOutsideTypes from './components/types/component-with-outside-types.lite';
export default function Homepage(props: { pathname?: string }) {
const state = useStore({
pathToUse: '',
log: () => {
console.log('logging');
},
});
onMount(() => {
state.pathToUse = props.pathname || window.location.pathname;
});
return (
<div>
<div>All tests:</div>
<ul>
<For each={COMPONENT_PATHS}>
{(x) => (
<li>
<a href={x}>{x}</a>
</li>
)}
</For>
</ul>
<Show when={state.pathToUse}>
<div>Current Test Component: {state.pathToUse}</div>
</Show>
<Show when={state.pathToUse.startsWith('/one-component')}>
<OneComponent />
</Show>
<Show when={state.pathToUse.startsWith('/two-component')}>
<NestedParent />
</Show>
<Show when={state.pathToUse.startsWith('/default-props')}>
<DefaultProps bar="xyz" />
</Show>
<Show when={state.pathToUse.startsWith('/types')}>
<ComponentWithInsideTypes name="Lorem ipsum" />
</Show>
<Show when={state.pathToUse.startsWith('/show-for-component')}>
<ShowForComponent />
</Show>
<Show when={state.pathToUse.startsWith('/special-tags')}>
<SpecialTags />
</Show>
<Show when={state.pathToUse.startsWith('/signals')}>
<SignalParent />
</Show>
<Show when={state.pathToUse.startsWith('/disabled-input')}>
<DisabledInput />
</Show>
<Show when={state.pathToUse.startsWith('/component-on-update')}>
<ComponentOnUpdate />
</Show>
<Show when={state.pathToUse.startsWith('/component-with-outside-types')}>
<ComponentWithOutsideTypes
text="Before"
onGetClicked={() => state.log()}
onEnter={() => state.log()}
/>
</Show>
</div>
);
}