diff --git a/.dumi/theme/builtins/InstallDependencies/index.tsx b/.dumi/theme/builtins/InstallDependencies/index.tsx index 5cfa9d42fb..68cc0f90f4 100644 --- a/.dumi/theme/builtins/InstallDependencies/index.tsx +++ b/.dumi/theme/builtins/InstallDependencies/index.tsx @@ -1,3 +1,4 @@ +import type { TabsProps } from 'antd'; import { Tabs } from 'antd'; import SourceCode from 'dumi/theme-default/builtins/SourceCode'; import React from 'react'; @@ -11,46 +12,51 @@ interface InstallProps { pnpm?: string; } +const npmLabel = ( + + + npm + +); + +const pnpmLabel = ( + + + pnpm + +); + +const yarnLabel = ( + + + yarn + +); + const InstallDependencies: React.FC = (props) => { const { npm, yarn, pnpm } = props; - return ( - ( + () => + [ { key: 'npm', - children: {npm}, - label: ( - - - npm - - ), + children: npm ? {npm} : null, + label: npmLabel, }, { key: 'yarn', - children: {yarn}, - label: ( - - - yarn - - ), + children: yarn ? {yarn} : null, + label: yarnLabel, }, { key: 'pnpm', - children: {pnpm}, - label: ( - - - pnpm - - ), + children: pnpm ? {pnpm} : null, + label: pnpmLabel, }, - ]} - /> + ].filter((item) => item.children), + [npm, yarn, pnpm], ); + return ; }; export default InstallDependencies;