2019-10-06 21:55:49 +07:00
|
|
|
import React, { useContext } from 'react';
|
|
|
|
import styled from 'react-emotion';
|
2019-06-20 19:37:28 +07:00
|
|
|
import List from '@material-ui/core/List';
|
2019-03-28 05:39:06 +07:00
|
|
|
|
2019-10-06 21:55:49 +07:00
|
|
|
import { DetailContext } from '../../pages/Version';
|
|
|
|
import { fontWeight } from '../../utils/styles/sizes';
|
2019-10-13 02:41:42 +07:00
|
|
|
import Text from '../../muiComponents/Text';
|
2019-08-25 19:34:27 +07:00
|
|
|
|
2019-10-06 21:55:49 +07:00
|
|
|
import InstallListItem, { DependencyManager } from './InstallListItem';
|
2019-02-03 17:23:33 +07:00
|
|
|
|
2019-10-13 02:41:42 +07:00
|
|
|
const StyledText = styled(Text)({
|
2019-10-06 21:55:49 +07:00
|
|
|
fontWeight: fontWeight.bold,
|
|
|
|
textTransform: 'capitalize',
|
|
|
|
});
|
2019-03-28 05:39:06 +07:00
|
|
|
|
2019-10-06 21:55:49 +07:00
|
|
|
const Install: React.FC = () => {
|
|
|
|
const detailContext = useContext(DetailContext);
|
2019-06-20 19:37:28 +07:00
|
|
|
|
2019-10-06 21:55:49 +07:00
|
|
|
const { packageMeta, packageName } = detailContext;
|
|
|
|
|
|
|
|
if (!packageMeta || !packageName) {
|
|
|
|
return null;
|
2019-03-28 05:39:06 +07:00
|
|
|
}
|
2019-02-03 17:23:33 +07:00
|
|
|
|
2019-10-06 21:55:49 +07:00
|
|
|
return (
|
2019-10-13 02:41:42 +07:00
|
|
|
<List data-testid={'installList'} subheader={<StyledText variant={'subtitle1'}>{'Installation'}</StyledText>}>
|
2019-10-06 21:55:49 +07:00
|
|
|
<InstallListItem dependencyManager={DependencyManager.NPM} packageName={packageName} />
|
|
|
|
<InstallListItem dependencyManager={DependencyManager.YARN} packageName={packageName} />
|
|
|
|
<InstallListItem dependencyManager={DependencyManager.PNPM} packageName={packageName} />
|
|
|
|
</List>
|
|
|
|
);
|
|
|
|
};
|
2019-02-03 17:23:33 +07:00
|
|
|
|
|
|
|
export default Install;
|