|
| 1 | +import { For } from "solid-js"; |
1 | 2 | import { useRoute } from "solid-navigation";
|
2 | 3 | import { useRouter } from '~/router'
|
3 | 4 |
|
4 | 5 | export const Home = () => {
|
5 | 6 | const router = useRouter();
|
6 | 7 |
|
7 |
| - const examples = [ |
8 |
| - {name: 'ActionBar'}, |
9 |
| - {name: 'ActivityIndicator'}, |
10 |
| - {name: 'Button'}, |
11 |
| - {name: 'DatePicker'}, |
12 |
| - {name: 'Dialogs'}, |
13 |
| - {name: 'HtmlView'}, |
14 |
| - {name: 'Image'}, |
15 |
| - {name: 'Label'}, |
16 |
| - {name: 'ListPicker'}, |
17 |
| - {name: 'ListView'}, |
18 |
| - {name: 'Placeholder'}, |
19 |
| - {name: 'Progress'}, |
20 |
| - {name: 'ScrollView'}, |
21 |
| - {name: 'SearchBar'}, |
22 |
| - {name: 'SegmentedBar'}, |
23 |
| - {name: 'Slider'}, |
24 |
| - {name: 'Switch'}, |
25 |
| - {name: 'TabView'}, |
26 |
| - {name: 'TextField'}, |
27 |
| - {name: 'TextView'}, |
28 |
| - {name: 'TimePicker'}, |
29 |
| - {name: 'WebView'}, |
| 8 | + const pages = [ |
| 9 | + {routeName: 'ActionBar', description:"ActionBar"}, |
| 10 | + {routeName: 'ActivityIndicator', description:"Activity Indicator"}, |
| 11 | + {routeName: 'Button', description:"Button"}, |
| 12 | + {routeName: 'DatePicker', description:"Date Picker"}, |
| 13 | + {routeName: 'Dialogs' , description:"Dialogs"}, |
| 14 | + {routeName: 'HtmlView' , description:"HTML View"}, |
| 15 | + {routeName: 'Image' , description:"Image"}, |
| 16 | + {routeName: 'Label', description:"Label"}, |
| 17 | + {routeName: 'ListPicker', description:"List Picker"}, |
| 18 | + {routeName: 'ListView', description:"List View"}, |
| 19 | + {routeName: 'Placeholder', description:"Placeholder"}, |
| 20 | + {routeName: 'Progress', description:"Progress"}, |
| 21 | + {routeName: 'ScrollView', description:"Scrollview"}, |
| 22 | + {routeName: 'SearchBar', description:"Search Bar"}, |
| 23 | + {routeName: 'SegmentedBar', description:"Segmented Bar"}, |
| 24 | + {routeName: 'Slider' , description:"Slider"}, |
| 25 | + {routeName: 'Switch', description:"Switch"}, |
| 26 | + {routeName: 'TabView', description:"TabView"}, |
| 27 | + {routeName: 'TextField', description:"Text Field"}, |
| 28 | + {routeName: 'TextView', description:"Text View"}, |
| 29 | + {routeName: 'TimePicker', description:"Time Picker"}, |
| 30 | + {routeName: 'WebView', description:"Web View"}, |
30 | 31 |
|
31 | 32 | ]
|
32 | 33 |
|
| 34 | + const navigate = (routeName:string) => { |
| 35 | + console.log(routeName) |
| 36 | + router.navigate(routeName); |
| 37 | + } |
| 38 | + |
33 | 39 |
|
34 | 40 | return (
|
35 | 41 | <>
|
36 | 42 | <actionbar title="Home"/>
|
37 | 43 | {/* @ts-ignore */}
|
38 |
| - <gridlayout rows="*,auto,*"> |
39 |
| - <button |
40 |
| - row="1" |
41 |
| - text={ "GO TO SCREEN B"} |
42 |
| - on:tap={() => { |
43 |
| - router.navigate("ActionBar"); |
44 |
| - }} |
45 |
| - /> |
46 |
| - |
47 |
| - </gridlayout> |
| 44 | + |
| 45 | + {/*<button*/} |
| 46 | + {/* row="1"*/} |
| 47 | + {/* text={ "GO TO SCREEN B"}*/} |
| 48 | + {/* on:tap={() => {*/} |
| 49 | + {/* router.navigate("ActionBar");*/} |
| 50 | + {/* }}*/} |
| 51 | + {/*/>*/} |
| 52 | + |
| 53 | + <scrollview orientation="vertical"> |
| 54 | + <stacklayout> |
| 55 | + <For each={pages}>{ |
| 56 | + |
| 57 | + (item, index) => ( |
| 58 | + <button on:tap={() => navigate(item.routeName)}>{item.description}</button> |
| 59 | + ) |
| 60 | + }</For> |
| 61 | + </stacklayout> |
| 62 | + </scrollview> |
48 | 63 | </>
|
49 | 64 | );
|
50 | 65 | };
|
0 commit comments