-
Notifications
You must be signed in to change notification settings - Fork 574
/
homepage.lite.tsx
66 lines (55 loc) · 1.87 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
import { For, onMount, Show, useStore } from '@builder.io/mitosis';
import { COMPONENT_PATHS } from './component-paths';
import ComponentWithTypes from './components/component-with-types.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';
export default function Homepage(props: { pathname?: string }) {
const state = useStore({
pathToUse: '',
});
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('/types')}>
<ComponentWithTypes 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>
</div>
);
}