1- import PinDropIcon from '@mui/icons-material/PinDrop' ;
2- import { Box , Typography } from '@mui/material' ;
3- import Link from 'next/link' ;
4- import * as React from 'react' ;
5-
6- import PageFooter from '@/component/PageFooter' ;
7- import { SITE_CONFIG } from '@/constant' ;
1+ import Homepage from '@/component/Homepage' ;
82import { getApiResponse } from '@/util/shared/get-api-response' ;
93
10- // !STARTERCONF -> Select !STARTERCONF and CMD + SHIFT + F
11- // Before you begin editing, follow all comments with `STARTERCONF`,
12- // to customize the default configuration.
13-
144const loadDataFromApi = async ( slug ?: string ) => {
155 if ( slug === 'testError500' ) {
166 throw new Error ( 'This is a ssr 500 test error' ) ;
@@ -21,59 +11,12 @@ const loadDataFromApi = async (slug?: string) => {
2111 } ) ;
2212} ;
2313
24- interface HomePageProps {
14+ interface AppHomeProps {
2515 searchParams : { [ key : string ] : string | undefined } ;
2616}
2717
28- export default async function HomePage ( { searchParams } : HomePageProps ) {
18+ export default async function AppHome ( { searchParams } : AppHomeProps ) {
2919 const apiResult = await loadDataFromApi ( searchParams [ 'slug' ] ) ;
3020
31- return (
32- < main >
33- < section >
34- < Box sx = { { textAlign : 'center' } } >
35- < PinDropIcon />
36- < Typography variant = 'h5' component = 'h1' gutterBottom >
37- { SITE_CONFIG . title }
38- </ Typography >
39- < Typography variant = 'subtitle2' gutterBottom >
40- { SITE_CONFIG . description }
41- </ Typography >
42-
43- < Typography
44- variant = 'subtitle1'
45- gutterBottom
46- sx = { { color : 'green' , mt : 3 } }
47- >
48- Get data from api test: The latest React version is{ ' ' }
49- { apiResult ?. version }
50- </ Typography >
51-
52- < Box sx = { { m : 5 } } >
53- < Link
54- href = 'https://github.com/AlexStack/nextjs-materia-mui-typescript-hook-form-scaffold-boilerplate-starter'
55- target = '_blank'
56- >
57- See the Github repository page
58- </ Link >
59- </ Box >
60- < Box sx = { { m : 5 } } >
61- < Link
62- href = 'https://vercel.com/new/clone?s=https%3A%2F%2Fgithub.com%2FAlexStack%2Fnextjs-materia-mui-typescript-hook-form-scaffold-boilerplate-starter& showOptionalTeamCreation = false '
63- target = '_blank'
64- >
65- Click here to deploy a demo site to your Vercel in 1 minute
66- </ Link >
67- </ Box >
68- < Box sx = { { m : 5 } } >
69- < Link href = '/test-page-not-exists' > Test 404 page not found</ Link >
70- </ Box >
71- < Box sx = { { m : 5 } } >
72- < Link href = '/?slug=testError500' > Test 500 error page</ Link >
73- </ Box >
74- </ Box >
75- </ section >
76- < PageFooter />
77- </ main >
78- ) ;
21+ return < Homepage reactVersion = { apiResult ?. version } /> ;
7922}
0 commit comments