File tree 3 files changed +19
-12
lines changed
theme-default/layout/Layout
3 files changed +19
-12
lines changed Original file line number Diff line number Diff line change
1
+ export const pageType = 'custom' ;
2
+
3
+ export default function Custom ( ) {
4
+ return < div > This is a custom component </ div > ;
5
+ }
Original file line number Diff line number Diff line change 1
-
2
1
import { hydrateRoot , createRoot } from 'react-dom/client' ;
3
2
import { ComponentType } from 'react' ;
4
3
import { BrowserRouter } from 'react-router-dom' ;
Original file line number Diff line number Diff line change @@ -2,28 +2,31 @@ import React from 'react';
2
2
import { HomeLayout } from '../HomeLayout' ;
3
3
import { Nav } from '../../components/Nav' ;
4
4
import { DocLayout } from '../DocLayout' ;
5
- import { usePageData } from 'island/client' ;
5
+ import { usePageData , Content } from 'island/client' ;
6
6
import { NotFoundLayout } from 'island/theme' ;
7
7
8
8
export const Layout : React . FC = ( ) => {
9
9
const { pageType } = usePageData ( ) ;
10
10
// Use doc layout by default
11
11
const getContentLayout = ( ) => {
12
- if ( pageType === 'home' ) {
13
- return < HomeLayout /> ;
14
- } else if ( pageType === 'doc' ) {
15
- return < DocLayout /> ;
16
- } else if ( pageType === '404' ) {
17
- return < NotFoundLayout /> ;
18
- } else {
19
- return < DocLayout /> ;
12
+ switch ( pageType ) {
13
+ case 'home' :
14
+ return < HomeLayout /> ;
15
+ case 'doc' :
16
+ return < DocLayout /> ;
17
+ case '404' :
18
+ return < NotFoundLayout /> ;
19
+ case 'custom' :
20
+ return < Content /> ;
21
+ default :
22
+ return < DocLayout /> ;
20
23
}
21
24
} ;
22
25
23
26
return (
24
- < div >
27
+ < div style = { { height : '100%' } } >
25
28
< Nav />
26
- { getContentLayout ( ) }
29
+ < section style = { { paddingTop : '72px' } } > { getContentLayout ( ) } </ section >
27
30
</ div >
28
31
) ;
29
32
} ;
You can’t perform that action at this time.
0 commit comments