2023-06-12 15:44:44 +08:00
|
|
|
import { Tabs } from 'antd';
|
|
|
|
import SourceCode from 'dumi/theme-default/builtins/SourceCode';
|
|
|
|
import React from 'react';
|
|
|
|
import NpmLogo from './npm';
|
|
|
|
import PnpmLogo from './pnpm';
|
|
|
|
import YarnLogo from './yarn';
|
|
|
|
|
|
|
|
interface InstallProps {
|
|
|
|
npm?: string;
|
|
|
|
yarn?: string;
|
|
|
|
pnpm?: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
const InstallDependencies: React.FC<InstallProps> = (props) => {
|
|
|
|
const { npm, yarn, pnpm } = props;
|
|
|
|
return (
|
|
|
|
<Tabs
|
|
|
|
className="antd-site-snippet"
|
|
|
|
defaultActiveKey="npm"
|
|
|
|
items={[
|
|
|
|
{
|
|
|
|
key: 'npm',
|
|
|
|
children: <SourceCode lang="bash">{npm}</SourceCode>,
|
|
|
|
label: (
|
2023-06-14 16:28:38 +08:00
|
|
|
<span className="snippet-label">
|
2023-06-12 15:44:44 +08:00
|
|
|
<NpmLogo />
|
2023-06-14 16:28:38 +08:00
|
|
|
npm
|
|
|
|
</span>
|
2023-06-12 15:44:44 +08:00
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'yarn',
|
|
|
|
children: <SourceCode lang="bash">{yarn}</SourceCode>,
|
|
|
|
label: (
|
2023-06-14 16:28:38 +08:00
|
|
|
<span className="snippet-label">
|
2023-06-12 15:44:44 +08:00
|
|
|
<YarnLogo />
|
2023-06-14 16:28:38 +08:00
|
|
|
yarn
|
|
|
|
</span>
|
2023-06-12 15:44:44 +08:00
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'pnpm',
|
|
|
|
children: <SourceCode lang="bash">{pnpm}</SourceCode>,
|
|
|
|
label: (
|
2023-06-14 16:28:38 +08:00
|
|
|
<span className="snippet-label">
|
2023-06-12 15:44:44 +08:00
|
|
|
<PnpmLogo />
|
2023-06-14 16:28:38 +08:00
|
|
|
pnpm
|
|
|
|
</span>
|
2023-06-12 15:44:44 +08:00
|
|
|
),
|
|
|
|
},
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default InstallDependencies;
|