mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-30 22:34:10 -05:00
feat: added versions. wip
This commit is contained in:
parent
3b2a068099
commit
5573ff5acd
3 changed files with 49 additions and 4 deletions
|
@ -7,6 +7,7 @@ import React, { Component } from 'react';
|
||||||
|
|
||||||
import { DetailContextConsumer } from '../../pages/version/index';
|
import { DetailContextConsumer } from '../../pages/version/index';
|
||||||
import Readme from '../Readme';
|
import Readme from '../Readme';
|
||||||
|
import Versions from '../Versions';
|
||||||
import { preventXSS } from '../../utils/sec-utils';
|
import { preventXSS } from '../../utils/sec-utils';
|
||||||
import Tabs from '@material-ui/core/Tabs/index';
|
import Tabs from '@material-ui/core/Tabs/index';
|
||||||
import Tab from '@material-ui/core/Tab/index';
|
import Tab from '@material-ui/core/Tab/index';
|
||||||
|
@ -43,7 +44,7 @@ class DetailContainer extends Component<any, any> {
|
||||||
<Content>
|
<Content>
|
||||||
{tabPosition === 0 && this.renderReadme(readMe)}
|
{tabPosition === 0 && this.renderReadme(readMe)}
|
||||||
{tabPosition === 1 && this.renderDependencies()}
|
{tabPosition === 1 && this.renderDependencies()}
|
||||||
{tabPosition === 2 && this.renderReadme(readMe)}
|
{tabPosition === 2 && this.renderVersions()}
|
||||||
{tabPosition === 3 && this.renderReadme(readMe)}
|
{tabPosition === 3 && this.renderReadme(readMe)}
|
||||||
</Content>
|
</Content>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
|
@ -56,9 +57,9 @@ class DetailContainer extends Component<any, any> {
|
||||||
return <Readme description={encodedReadme} />;
|
return <Readme description={encodedReadme} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
renderDependencies = () => {
|
renderVersions = () => <Versions />;
|
||||||
return <Dependencies />;
|
|
||||||
};
|
renderDependencies = () => <Dependencies />;
|
||||||
|
|
||||||
handleChange = (event: any, tabPosition: number) => {
|
handleChange = (event: any, tabPosition: number) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
38
src/webui/components/Versions/index.js
Normal file
38
src/webui/components/Versions/index.js
Normal 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;
|
6
src/webui/components/Versions/types.js
Normal file
6
src/webui/components/Versions/types.js
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
/**
|
||||||
|
* @prettier
|
||||||
|
* @flow
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface IProps {}
|
Loading…
Reference in a new issue