|
1 | | -'use client'; |
2 | | - |
3 | | -import { useState } from 'react'; |
4 | | -import { InfiniteListSimple } from '../components/infinite-list-simple'; |
5 | | -import { InfiniteListWithHorizontalScroll } from '../components/infinite-list-with-horizontal-scroll'; |
6 | | -import { InfiniteListWithReverseHozirontalScroll } from '../components/infinite-list-with-reverse-horizontal-scroll'; |
7 | | -import { InfiniteListWithReverseVerticalScroll } from '../components/infinite-list-with-reverse-vertical-scroll'; |
8 | | -import { InfiniteListWithVerticalScroll } from '../components/infinite-list-with-vertical-scroll'; |
9 | | - |
10 | | -enum InfiniteListType { |
11 | | - SIMPLE, |
12 | | - VERTICAL_SCROLL, |
13 | | - HORIZONTAL_SCROLL, |
14 | | - REVERSE_VERTICAL_SCROLL, |
15 | | - REVERSE_HORIZONTAL_SCROLL, |
16 | | -} |
17 | | - |
18 | | -export default function Page() { |
19 | | - const [listType, setListType] = useState<InfiniteListType>( |
20 | | - InfiniteListType.SIMPLE, |
21 | | - ); |
22 | | - |
23 | | - let InfiniteList; |
24 | | - |
25 | | - switch (listType) { |
26 | | - case InfiniteListType.VERTICAL_SCROLL: { |
27 | | - InfiniteList = InfiniteListWithVerticalScroll; |
28 | | - break; |
29 | | - } |
30 | | - case InfiniteListType.HORIZONTAL_SCROLL: { |
31 | | - InfiniteList = InfiniteListWithHorizontalScroll; |
32 | | - break; |
33 | | - } |
34 | | - case InfiniteListType.REVERSE_VERTICAL_SCROLL: { |
35 | | - InfiniteList = InfiniteListWithReverseVerticalScroll; |
36 | | - break; |
37 | | - } |
38 | | - case InfiniteListType.REVERSE_HORIZONTAL_SCROLL: { |
39 | | - InfiniteList = InfiniteListWithReverseHozirontalScroll; |
40 | | - break; |
41 | | - } |
42 | | - default: { |
43 | | - InfiniteList = InfiniteListSimple; |
44 | | - } |
45 | | - } |
| 1 | +import Link from 'next/link'; |
| 2 | +import { PageTitle } from '../components/page-title'; |
46 | 3 |
|
| 4 | +export default function HomePage() { |
47 | 5 | return ( |
48 | | - <main className="flex flex-col gap-2 p-4"> |
49 | | - <h1 className="text-2xl font-black">Infinite List</h1> |
50 | | - <p className="text-xl font-bold"> |
51 | | - Created by using “react-infinite-scroll-hook” |
| 6 | + <main> |
| 7 | + <PageTitle>Home</PageTitle> |
| 8 | + <p> |
| 9 | + Select one of the options to see the live demo and their source code. |
52 | 10 | </p> |
53 | | - <label htmlFor="listType" className="font-semibold"> |
54 | | - List Type |
55 | | - <select |
56 | | - id="listType" |
57 | | - className="ml-2 rounded border p-1" |
58 | | - value={listType} |
59 | | - onChange={(e) => { |
60 | | - setListType(Number.parseInt(e.target.value)); |
61 | | - }} |
| 11 | + <p> |
| 12 | + This is a very simple demo website for `react-infinite-scroll-hook` only |
| 13 | + to have some live demos for users. |
| 14 | + </p> |
| 15 | + <p> |
| 16 | + You can check the full source code and docs{' '} |
| 17 | + <Link |
| 18 | + href="https://github.com/onderonur/react-infinite-scroll-hook" |
| 19 | + className="font-semibold text-slate-600" |
62 | 20 | > |
63 | | - <option value={InfiniteListType.SIMPLE}>Simple List</option> |
64 | | - <option value={InfiniteListType.VERTICAL_SCROLL}> |
65 | | - Vertically Scrollable List |
66 | | - </option> |
67 | | - <option value={InfiniteListType.HORIZONTAL_SCROLL}> |
68 | | - Horizontally Scrollable List |
69 | | - </option> |
70 | | - <option value={InfiniteListType.REVERSE_VERTICAL_SCROLL}> |
71 | | - Reversed Vertically Scrollable List |
72 | | - </option> |
73 | | - <option value={InfiniteListType.REVERSE_HORIZONTAL_SCROLL}> |
74 | | - Reversed Horizontally Scrollable List |
75 | | - </option> |
76 | | - </select> |
77 | | - </label> |
78 | | - <InfiniteList /> |
| 21 | + here |
| 22 | + </Link> |
| 23 | + . |
| 24 | + </p> |
79 | 25 | </main> |
80 | 26 | ); |
81 | 27 | } |
0 commit comments