mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-21 13:18:04 +08:00
59ad48476b
* chore: add boime lint * fix lint * use files ignore * revert change * ignore clarity.js * fix some errors * fix some errors * fix some errors * fix some errors * add yml file * Update clarity.js Signed-off-by: afc163 <afc163@gmail.com> * add npm run lint:biome * add npm run lint:biome * fix test case * fix ts errors * fix ts errors * fix lint and add .lintstagedrc * shorten prop name * chore: update package.json * update biome.json * chore: remove stylelint * chore: useOptionalChain * fix lint * biome format * prettier all code * prettier all code * fix site test --------- Signed-off-by: afc163 <afc163@gmail.com>
55 lines
1.4 KiB
TypeScript
55 lines
1.4 KiB
TypeScript
import React from 'react';
|
|
import { ConfigProvider, Tabs } from 'antd';
|
|
import SourceCode from 'dumi/theme-default/builtins/SourceCode';
|
|
import type { Tab } from 'rc-tabs/lib/interface';
|
|
|
|
import BunLogo from './bun';
|
|
import NpmLogo from './npm';
|
|
import PnpmLogo from './pnpm';
|
|
import YarnLogo from './yarn';
|
|
|
|
interface InstallProps {
|
|
npm?: string;
|
|
yarn?: string;
|
|
pnpm?: string;
|
|
bun?: string;
|
|
}
|
|
|
|
const InstallDependencies: React.FC<InstallProps> = (props) => {
|
|
const { npm, yarn, pnpm, bun } = props;
|
|
const items: Tab[] = [
|
|
{
|
|
key: 'npm',
|
|
label: 'npm',
|
|
children: npm ? <SourceCode lang="bash">{npm}</SourceCode> : null,
|
|
icon: <NpmLogo />,
|
|
},
|
|
{
|
|
key: 'yarn',
|
|
label: 'yarn',
|
|
children: yarn ? <SourceCode lang="bash">{yarn}</SourceCode> : null,
|
|
icon: <YarnLogo />,
|
|
},
|
|
{
|
|
key: 'pnpm',
|
|
label: 'pnpm',
|
|
children: pnpm ? <SourceCode lang="bash">{pnpm}</SourceCode> : null,
|
|
icon: <PnpmLogo />,
|
|
},
|
|
{
|
|
key: 'bun',
|
|
label: 'Bun',
|
|
children: bun ? <SourceCode lang="bash">{bun}</SourceCode> : null,
|
|
icon: <BunLogo />,
|
|
},
|
|
].filter((item) => item.children);
|
|
|
|
return (
|
|
<ConfigProvider theme={{ components: { Tabs: { horizontalMargin: '0' } } }}>
|
|
<Tabs className="markdown" size="small" defaultActiveKey="npm" items={items} />
|
|
</ConfigProvider>
|
|
);
|
|
};
|
|
|
|
export default InstallDependencies;
|