Skip to content

Commit 2f91b57

Browse files
authored
Docs/add default devs tab (#3388)
* Fix live code preview iframe source in prod * Reorganize scripts into folders * Add default dev tab * Revert "Fix live code preview iframe source in prod" This reverts commit 67f7570. * Clean default tab * Fix content
1 parent 58f6fb1 commit 2f91b57

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

docuilib/src/components/ComponentPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import './ComponentPage.module.scss';
66
import {ListSection} from './pageComponents/ListSection';
77
import {Section} from './pageComponents/Section';
88
import {Banner} from './pageComponents/Banner';
9+
import {devTab} from './pageComponents/DefaultTabs';
910

1011
export default function ComponentPage({component}) {
1112
const Divider = section => {
@@ -62,7 +63,7 @@ export default function ComponentPage({component}) {
6263

6364
// TODO: align Tabs bottom border with TabItem's selected indication line
6465
if (tabs) {
65-
return <Tabs className="main-tabs">{getTabItems(tabs)}</Tabs>;
66+
return <Tabs className="main-tabs">{getTabItems([...tabs, devTab])}</Tabs>;
6667
}
6768
};
6869

docuilib/src/components/pageComponents/Banner.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import _ from 'lodash';
22
import React from 'react';
3+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
34
import '../ComponentPage.module.scss';
45

56
export const Banner = ({section, component}) => {
7+
const {siteConfig} = useDocusaurusContext();
8+
69
const getColor = type => {
710
switch (type) {
811
case 'tip':
@@ -43,8 +46,7 @@ export const Banner = ({section, component}) => {
4346
const comma = isLast ? '' : ', ';
4447
return (
4548
<a
46-
href={links[index]}
47-
target="_blank"
49+
href={links?.[index] ?? `${siteConfig?.baseUrl}docs/components/${component}`}
4850
rel="noreferrer"
4951
style={{fontSize: '16px', fontWeight: '700', lineHeight: '18px', borderBottom: '1px solid'}}
5052
>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export const devTab = {
2+
title: 'Dev',
3+
sections: [
4+
{
5+
title: 'Usage',
6+
type: 'usage'
7+
},
8+
{
9+
type: 'info'
10+
},
11+
{
12+
type: 'tip'
13+
},
14+
{
15+
type: 'props',
16+
title: 'API',
17+
description: 'This is the list of additional props for the component'
18+
}
19+
]
20+
};

0 commit comments

Comments
 (0)