0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-23 22:27:34 -05:00

feat: added versions. wip

This commit is contained in:
Priscila Oliveira 2019-01-14 22:31:49 +01:00
parent 3b2a068099
commit 5573ff5acd
3 changed files with 49 additions and 4 deletions

View file

@ -7,6 +7,7 @@ import React, { Component } from 'react';
import { DetailContextConsumer } from '../../pages/version/index';
import Readme from '../Readme';
import Versions from '../Versions';
import { preventXSS } from '../../utils/sec-utils';
import Tabs from '@material-ui/core/Tabs/index';
import Tab from '@material-ui/core/Tab/index';
@ -43,7 +44,7 @@ class DetailContainer extends Component<any, any> {
<Content>
{tabPosition === 0 && this.renderReadme(readMe)}
{tabPosition === 1 && this.renderDependencies()}
{tabPosition === 2 && this.renderReadme(readMe)}
{tabPosition === 2 && this.renderVersions()}
{tabPosition === 3 && this.renderReadme(readMe)}
</Content>
</React.Fragment>
@ -56,9 +57,9 @@ class DetailContainer extends Component<any, any> {
return <Readme description={encodedReadme} />;
};
renderDependencies = () => {
return <Dependencies />;
};
renderVersions = () => <Versions />;
renderDependencies = () => <Dependencies />;
handleChange = (event: any, tabPosition: number) => {
event.preventDefault();

View file

@ -0,0 +1,38 @@
/**
* @prettier
* @flow
*/
import React from 'react';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import { DetailContextConsumer } from '../../pages/version/index';
class Versions extends React.PureComponent {
render() {
return (
<DetailContextConsumer>
{({ packageMeta }) => {
const { versions } = packageMeta;
if (versions) {
return this.renderVersions(versions);
}
}}
</DetailContextConsumer>
);
}
// $FlowFixMe
renderVersions(versions) {
return (
<List>
{Object.keys(versions).map(version => (
<ListItem key={version}>{versions[version].name}</ListItem>
))}
</List>
);
}
}
export default Versions;

View file

@ -0,0 +1,6 @@
/**
* @prettier
* @flow
*/
export interface IProps {}