File tree Expand file tree Collapse file tree 4 files changed +28
-48
lines changed Expand file tree Collapse file tree 4 files changed +28
-48
lines changed Original file line number Diff line number Diff line change @@ -60,10 +60,12 @@ export default function ComponentPage({component}) {
60
60
61
61
const buildTabs = ( ) => {
62
62
const tabs = component . docs ?. tabs ;
63
-
63
+ const api = component . props ;
64
+ const tabsArray = api ? [ ...tabs , devTab ] : tabs ;
65
+
64
66
// TODO: align Tabs bottom border with TabItem's selected indication line
65
67
if ( tabs ) {
66
- return < Tabs className = "main-tabs" > { getTabItems ( [ ... tabs , devTab ] ) } </ Tabs > ;
68
+ return < Tabs className = "main-tabs" > { getTabItems ( tabsArray ) } </ Tabs > ;
67
69
}
68
70
} ;
69
71
Original file line number Diff line number Diff line change @@ -89,6 +89,10 @@ export const Banner = ({section, component}) => {
89
89
const _title = title || getTitle ( type ) ;
90
90
const _description = description || getDescription ( type ) ;
91
91
92
+ if ( ! _description ) {
93
+ return null ;
94
+ }
95
+
92
96
return (
93
97
< div
94
98
className = "row"
Original file line number Diff line number Diff line change @@ -25,6 +25,25 @@ export const SectionHeader = ({section, component}) => {
25
25
return type === 'item' ? '#6E7881' : '#495059' ;
26
26
} ;
27
27
28
+ const getUsageTitle = ( ) => {
29
+ if ( component . snippet ) {
30
+ return (
31
+ < div
32
+ style = { {
33
+ display : 'flex' ,
34
+ flexDirection : 'row' ,
35
+ alignItems : 'center' ,
36
+ justifyContent : 'space-between' ,
37
+ marginBottom : 12
38
+ } }
39
+ >
40
+ { getTitle ( type , title ) }
41
+ { getCodeExampleLink ( ) }
42
+ </ div >
43
+ ) ;
44
+ }
45
+ } ;
46
+
28
47
const getCodeExampleLink = ( ) => {
29
48
return (
30
49
< a
@@ -66,20 +85,7 @@ export const SectionHeader = ({section, component}) => {
66
85
67
86
switch ( type ) {
68
87
case 'usage' :
69
- return (
70
- < div
71
- style = { {
72
- display : 'flex' ,
73
- flexDirection : 'row' ,
74
- alignItems : 'center' ,
75
- justifyContent : 'space-between' ,
76
- marginBottom : 12
77
- } }
78
- >
79
- { getTitle ( type , title ) }
80
- { getCodeExampleLink ( ) }
81
- </ div >
82
- ) ;
88
+ return getUsageTitle ( ) ;
83
89
default :
84
90
return (
85
91
< div
Original file line number Diff line number Diff line change 285
285
"description" : " html:<h2>Title</h2><p>This is a html content</p><ul><li>item 1</li><li>item 2</li></ul>"
286
286
}
287
287
]
288
- },
289
- {
290
- "title" : " Code" ,
291
- "sections" : [
292
- {
293
- "title" : " Usage" ,
294
- "type" : " usage"
295
- },
296
- {
297
- "type" : " info"
298
- },
299
- {
300
- "type" : " tip"
301
- },
302
- {
303
- "type" : " banner" ,
304
- "title" : " NOTE" ,
305
- "description" : " This is an interesting information"
306
- },
307
- {
308
- "type" : " banner" ,
309
- "title" : " Banner" ,
310
- "description" : " This is some massage to the user" ,
311
- "color" : " pink" ,
312
- "icon" : " "
313
- },
314
- {
315
- "type" : " props" ,
316
- "title" : " API" ,
317
- "description" : " This is the list of additional props for the Text component"
318
- }
319
- ]
320
288
}
321
289
]
322
290
}
You can’t perform that action at this time.
0 commit comments