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}) {
6060
6161 const buildTabs = ( ) => {
6262 const tabs = component . docs ?. tabs ;
63-
63+ const api = component . props ;
64+ const tabsArray = api ? [ ...tabs , devTab ] : tabs ;
65+
6466 // TODO: align Tabs bottom border with TabItem's selected indication line
6567 if ( tabs ) {
66- return < Tabs className = "main-tabs" > { getTabItems ( [ ... tabs , devTab ] ) } </ Tabs > ;
68+ return < Tabs className = "main-tabs" > { getTabItems ( tabsArray ) } </ Tabs > ;
6769 }
6870 } ;
6971
Original file line number Diff line number Diff line change @@ -89,6 +89,10 @@ export const Banner = ({section, component}) => {
8989 const _title = title || getTitle ( type ) ;
9090 const _description = description || getDescription ( type ) ;
9191
92+ if ( ! _description ) {
93+ return null ;
94+ }
95+
9296 return (
9397 < div
9498 className = "row"
Original file line number Diff line number Diff line change @@ -25,6 +25,25 @@ export const SectionHeader = ({section, component}) => {
2525 return type === 'item' ? '#6E7881' : '#495059' ;
2626 } ;
2727
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+
2847 const getCodeExampleLink = ( ) => {
2948 return (
3049 < a
@@ -66,20 +85,7 @@ export const SectionHeader = ({section, component}) => {
6685
6786 switch ( type ) {
6887 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 ( ) ;
8389 default :
8490 return (
8591 < div
Original file line number Diff line number Diff line change 285285 "description" : " html:<h2>Title</h2><p>This is a html content</p><ul><li>item 1</li><li>item 2</li></ul>"
286286 }
287287 ]
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- ]
320288 }
321289 ]
322290 }
You can’t perform that action at this time.
0 commit comments