verdaccio-ui/src/components/Install/Install.tsx
Priscila Oliveira 9eb698f7e1 fix: install Component - Replaced class by func. comp (#152)
* refactor: convert class to func comp

* fix: fixed wrong maintainer type

* refactor: created a partials folder

* fix: fixed test
2019-10-06 16:55:49 +02:00

35 lines
1.1 KiB
TypeScript

import React, { useContext } from 'react';
import styled from 'react-emotion';
import Typography from '@material-ui/core/Typography';
import List from '@material-ui/core/List';
import { DetailContext } from '../../pages/Version';
import { fontWeight } from '../../utils/styles/sizes';
import InstallListItem, { DependencyManager } from './InstallListItem';
const Heading = styled(Typography)({
fontWeight: fontWeight.bold,
textTransform: 'capitalize',
});
const Install: React.FC = () => {
const detailContext = useContext(DetailContext);
const { packageMeta, packageName } = detailContext;
if (!packageMeta || !packageName) {
return null;
}
return (
<List data-testid={'installList'} subheader={<Heading variant={'subtitle1'}>{'Installation'}</Heading>}>
<InstallListItem dependencyManager={DependencyManager.NPM} packageName={packageName} />
<InstallListItem dependencyManager={DependencyManager.YARN} packageName={packageName} />
<InstallListItem dependencyManager={DependencyManager.PNPM} packageName={packageName} />
</List>
);
};
export default Install;