File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change 1
1
const config = require ( '../docusaurus.config' ) ;
2
2
3
- const { baseUrl } = config ;
3
+ const { baseUrl, customFields } = config ;
4
+
5
+ function generateMoreExamples ( componentName ) {
6
+ const componentMoreExamples = customFields . moreExamples [ componentName ] ;
7
+
8
+ if ( ! componentMoreExamples ) {
9
+ return `<span />` ;
10
+ }
11
+
12
+ const links = Object . entries ( componentMoreExamples )
13
+ . map ( ( [ key , value ] ) => {
14
+ return `
15
+ <li key="${ key } ">
16
+ <a href="${ value } ">${ key } </a>
17
+ </li>
18
+ ` ;
19
+ } )
20
+ . join ( '' ) ;
21
+
22
+ return `
23
+ ## More Examples
24
+ <details>
25
+ <summary>Toggle to grab more examples</summary>
26
+ <ul>
27
+ ${ links }
28
+ </ul>
29
+ </details>
30
+ ` ;
31
+ }
4
32
5
33
function generatePageMDX ( doc , link ) {
6
34
const description = doc . description
@@ -17,6 +45,8 @@ import PropTable from '@site/src/components/PropTable.tsx';
17
45
18
46
${ description }
19
47
48
+ ${ generateMoreExamples ( doc . title ) }
49
+
20
50
## Props
21
51
22
52
<PropTable link="${ link } " />
Original file line number Diff line number Diff line change @@ -289,6 +289,15 @@ const config = {
289
289
indexName : 'crawler_React Native Paper Docs' ,
290
290
} ,
291
291
} ) ,
292
+
293
+ customFields : {
294
+ moreExamples : {
295
+ Portal : {
296
+ 'Comprehensive Portal example' :
297
+ 'https://snack.expo.dev/@react-native-paper/comprehensive-portal-example' ,
298
+ } ,
299
+ } ,
300
+ } ,
292
301
} ;
293
302
294
303
module . exports = config ;
You can’t perform that action at this time.
0 commit comments