mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-23 22:27:34 -05:00
feat: added uplinks component
This commit is contained in:
parent
05498fe651
commit
6c3276926e
3 changed files with 72 additions and 0 deletions
43
src/webui/components/UpLinks/index.js
Normal file
43
src/webui/components/UpLinks/index.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* @prettier
|
||||
* @flow
|
||||
*/
|
||||
|
||||
import { DetailContextConsumer } from '../../pages/version/index';
|
||||
import { Heading, ListItem, CardContent } from './styles';
|
||||
import List from '@material-ui/core/List';
|
||||
import Chip from '@material-ui/core/Chip';
|
||||
import Card from '@material-ui/core/Card';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
class UpLinks extends React.PureComponent {
|
||||
render() {
|
||||
return <DetailContextConsumer>{({ packageMeta }) => this.renderContent(packageMeta._uplinks)}</DetailContextConsumer>;
|
||||
}
|
||||
|
||||
renderList = (uplinks: object) => (
|
||||
<List>
|
||||
{Object.keys(uplinks)
|
||||
.reverse()
|
||||
.map(name => (
|
||||
<ListItem key={name}>
|
||||
<Chip label={name} />
|
||||
</ListItem>
|
||||
))}
|
||||
</List>
|
||||
);
|
||||
|
||||
// $FlowFixMe
|
||||
renderContent = uplinks =>
|
||||
uplinks && (
|
||||
<Card>
|
||||
<CardContent>
|
||||
<Heading variant={'subheading'}>{'UpLinks'}</Heading>
|
||||
{this.renderList(uplinks)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
export default UpLinks;
|
23
src/webui/components/UpLinks/styles.js
Normal file
23
src/webui/components/UpLinks/styles.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
import styled from 'react-emotion';
|
||||
import Typography from '@material-ui/core/Typography';
|
||||
import { default as MuiListItem } from '@material-ui/core/ListItem';
|
||||
import { default as MuiCardContent } from '@material-ui/core/CardContent';
|
||||
|
||||
export const Heading = styled(Typography)`
|
||||
&& {
|
||||
font-weight: 700;
|
||||
}
|
||||
`;
|
||||
|
||||
export const ListItem = styled(MuiListItem)`
|
||||
&& {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
`;
|
||||
|
||||
export const CardContent = styled(MuiCardContent)`
|
||||
&& {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
`;
|
6
src/webui/components/UpLinks/types.js
Normal file
6
src/webui/components/UpLinks/types.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
/**
|
||||
* @prettier
|
||||
* @flow
|
||||
*/
|
||||
|
||||
export interface IProps {}
|
Loading…
Reference in a new issue