1
0
Fork 1
mirror of https://github.com/SomboChea/ui synced 2024-06-02 01:25:05 +07:00
verdaccio-ui/src/webui/components/DetailSidebar/index.js

96 lines
2.2 KiB
JavaScript
Raw Normal View History

2019-02-03 17:23:33 +07:00
import React, {Component} from 'react';
2019-03-28 05:39:06 +07:00
import Card from '@material-ui/core/Card/index';
import CardContent from '@material-ui/core/CardContent/index';
import List from '@material-ui/core/List/index';
2019-02-03 17:23:33 +07:00
2019-03-28 05:39:06 +07:00
import ActtionBar from '../ActionBar';
import Author from '../Author';
import Developers from '../Developers';
import Dist from '../Dist';
import Engine from '../Engines';
2019-02-03 17:23:33 +07:00
import Install from '../Install';
import Repository from '../Repository';
2019-03-28 05:39:06 +07:00
import { DetailContextConsumer } from '../../pages/version/index';
import { TitleListItem, TitleListItemText } from './styles';
class DetailSidebar extends Component {
2019-02-03 17:23:33 +07:00
render() {
return (
<DetailContextConsumer>
{(context) => this.renderSideBar(context)}
</DetailContextConsumer>
);
};
2019-03-28 05:39:06 +07:00
renderSideBar = ({packageName, packageMeta}) => {
2019-02-03 17:23:33 +07:00
return (
2019-03-28 05:39:06 +07:00
<div className={'sidebar-info'}>
<Card>
<CardContent>
2019-02-03 17:23:33 +07:00
{this.renderTitle(packageName, packageMeta)}
2019-03-28 05:39:06 +07:00
{this.renderActionBar()}
2019-02-03 17:23:33 +07:00
{this.renderCopyCLI()}
2019-03-28 05:39:06 +07:00
{this.renderRepository()}
{this.renderEngine()}
{this.renderDist()}
{this.renderAuthor()}
2019-02-03 17:23:33 +07:00
{this.renderMaintainers()}
{this.renderContributors()}
2019-03-28 05:39:06 +07:00
</CardContent>
</Card>
</div>
2019-02-03 17:23:33 +07:00
);
}
renderTitle = (packageName, packageMeta) => {
return (
2019-03-28 05:39:06 +07:00
<List className={'detail-info'}>
<TitleListItem alignItems={"flex-start"}>
<TitleListItemText
primary={<b>{packageName}</b>}
secondary={packageMeta.latest.description}
/>
</TitleListItem>
</List>
2019-02-03 17:23:33 +07:00
);
}
renderCopyCLI = () => {
return <Install />;
}
renderMaintainers = () => {
return <Developers type={'maintainers'} />;
}
renderContributors = () => {
return <Developers type={'contributors'} />;
}
renderRepository = () => {
return <Repository />;
}
renderAuthor = () => {
2019-03-28 05:39:06 +07:00
return <Author />;
2019-02-03 17:23:33 +07:00
}
2019-03-28 05:39:06 +07:00
renderEngine = () => {
return <Engine />;
}
renderDist = () => {
return <Dist />;
}
renderActionBar = () => {
return <ActtionBar />;
}
}
2019-02-03 17:23:33 +07:00
export default DetailSidebar;