mirror of
https://github.com/SomboChea/ui
synced 2024-11-16 03:04:27 +07:00
42d3bb8508
* refactor: convert class to func * refactor: changed login form logic * refactor: conver to testing-library tests * refactor: moved dependency * refactor: replaced uglifyjs-webpack-plugin by terser-webpack-plugin * fix: fixed e2e errors * fix: fixed e2e test * Delete settings.json * fix: vscode settings rollback * refactor: rollback webpack config * refactor: updated eslint rule * fix: removed --fix * refactor: incresed the bundle size
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
import React, { useContext } from 'react';
|
|
|
|
import { DetailContext } from '../../pages/Version';
|
|
import Avatar from '../../muiComponents/Avatar';
|
|
import List from '../../muiComponents/List';
|
|
import npm from '../Install/img/npm.svg';
|
|
import ListItemText from '../../muiComponents/ListItemText';
|
|
import Grid from '../../muiComponents/Grid';
|
|
|
|
import { StyledText, EngineListItem } from './styles';
|
|
import node from './img/node.png';
|
|
|
|
const Engine: React.FC = () => {
|
|
const { packageMeta } = useContext(DetailContext);
|
|
|
|
const engines = packageMeta?.latest?.engines;
|
|
|
|
if (!engines || (!engines.node && !engines.npm)) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<Grid container={true}>
|
|
{engines.node && (
|
|
<Grid item={true} xs={6}>
|
|
<List subheader={<StyledText variant={'subtitle1'}>{'node JS'}</StyledText>}>
|
|
<EngineListItem button={true}>
|
|
<Avatar src={node} />
|
|
<ListItemText primary={engines.node} />
|
|
</EngineListItem>
|
|
</List>
|
|
</Grid>
|
|
)}
|
|
|
|
{engines.npm && (
|
|
<Grid item={true} xs={6}>
|
|
<List subheader={<StyledText variant={'subtitle1'}>{'NPM version'}</StyledText>}>
|
|
<EngineListItem button={true}>
|
|
<Avatar src={npm} />
|
|
<ListItemText primary={engines.npm} />
|
|
</EngineListItem>
|
|
</List>
|
|
</Grid>
|
|
)}
|
|
</Grid>
|
|
);
|
|
};
|
|
|
|
export default Engine;
|