diff --git a/src/webui/components/Author/index.js b/src/webui/components/Author/index.js index 7f1c30b89..8a4695c3a 100644 --- a/src/webui/components/Author/index.js +++ b/src/webui/components/Author/index.js @@ -1,54 +1,44 @@ -/* eslint no-unused-vars: 0 */ +/** + * @flow + * @prettier + */ -import React, {Component, Fragment} from 'react'; +import React, { Component } from 'react'; import { DetailContextConsumer } from '../../pages/version/index'; -import Card from '@material-ui/core/Card/index'; -import CardContent from '@material-ui/core/CardContent/index'; -import CopyToClipBoard from '../CopyToClipBoard'; -import CardHeader from '@material-ui/core/CardHeader/index'; import Avatar from '@material-ui/core/Avatar'; -import CardActions from '@material-ui/core/CardActions'; -import Typography from "@material-ui/core/Typography/index"; +import List from '@material-ui/core/List'; +// import ListItem from '@material-ui/core/ListItem'; +import ListItemText from '@material-ui/core/ListItemText'; +import { Heading, InstallItem } from './styles'; class Authors extends Component { render() { return ( - {(context) => { + {context => { return this.renderAuthor(context); }} ); - }; + } - renderAuthor = ({packageMeta}) => { + renderAuthor = ({ packageMeta }) => { const { author } = packageMeta.latest; - + if (!author) { return null; } return ( - - - {this.renderAvatar(author)} - - + {'Author'}}> + + + + + ); - } - - renderAvatar = ({name, email, url, avatar}) => { - return ( - - - - {name} - - - ); - } + }; } - export default Authors; diff --git a/src/webui/components/Author/styles.js b/src/webui/components/Author/styles.js new file mode 100644 index 000000000..b61775cd2 --- /dev/null +++ b/src/webui/components/Author/styles.js @@ -0,0 +1,23 @@ +/** + * @prettier + * @flow + */ + +import styled from 'react-emotion'; +import Typography from '@material-ui/core/Typography'; +import ListItem from '@material-ui/core/ListItem'; + +export const Heading = styled(Typography)` + && { + font-weight: 700; + margin-bottom: 10px; + text-transform: capitalize; + } +`; + +export const InstallItem = styled(ListItem)` + && { + padding-top: 0px; + padding-bottom: 0px; + } +`; diff --git a/src/webui/components/Dependencies/index.js b/src/webui/components/Dependencies/index.js index aa248b8dd..c64e45bb7 100644 --- a/src/webui/components/Dependencies/index.js +++ b/src/webui/components/Dependencies/index.js @@ -88,10 +88,7 @@ class Dependencies extends Component { // $FlowFixMe renderDependencies({ packageMeta }) { const { latest } = packageMeta; - // console.log('renderDependencies', latest); const { dependencies, devDependencies, peerDependencies } = latest; - // console.log('dependencies', dependencies); - // console.log('devDependencies', devDependencies); return ( diff --git a/src/webui/components/DetailSidebar/index.js b/src/webui/components/DetailSidebar/index.js index a0c5e77a4..6d0b9e63d 100644 --- a/src/webui/components/DetailSidebar/index.js +++ b/src/webui/components/DetailSidebar/index.js @@ -1,17 +1,19 @@ import React, {Component} from 'react'; -import { DetailContextConsumer } from '../../pages/version/index'; -import Typography from '@material-ui/core/Typography/index'; -import Grid from '@material-ui/core/Grid/index'; +import Card from '@material-ui/core/Card'; +import CardContent from '@material-ui/core/CardContent'; +import List from '@material-ui/core/List'; +import ListItem from '@material-ui/core/ListItem'; +import ListItemText from '@material-ui/core/ListItemText'; +import Avatar from '@material-ui/core/Avatar'; import Install from '../Install'; -import { Content } from './styles'; -import Authors from '../Author'; +import Author from '../Author'; import License from '../License'; import Repository from '../Repository'; import Developers from '../Developers'; - -class DetailSidebar extends Component { +import { DetailContextConsumer } from '../../pages/version/index'; +class DetailSidebar extends Component { render() { return ( @@ -20,43 +22,35 @@ class DetailSidebar extends Component { ); }; - renderSideBar = ({packageMeta, packageName}) => { + renderSideBar = ({packageName, packageMeta}) => { return ( - - - + <> + + {this.renderTitle(packageName, packageMeta)} - - {this.renderCopyCLI()} - - - {this.renderSecondLevel(8)} - - - {this.renderMaintainers()} - - - {this.renderContributors()} - - {this.renderRepository()} - - - + {this.renderAuthor()} + {this.renderMaintainers()} + {this.renderContributors()} + {this.renderLicense()} + + + ); } renderTitle = (packageName, packageMeta) => { return ( - <> - - {packageName} - - - {packageMeta.latest.description} - - + + + {packageName[0]} + {packageName}} + secondary={packageMeta.latest.description} + /> + + ); } @@ -72,12 +66,8 @@ class DetailSidebar extends Component { return ; } - renderSecondLevel = (spacing = 24) => { - return ( - - {this.renderAuthor()} - - ); + renderLicense = () => { + return ; } renderRepository = () => { @@ -85,18 +75,8 @@ class DetailSidebar extends Component { } renderAuthor = () => { - return ( - <> - - - - - - - - ); + return ; } } - export default DetailSidebar; diff --git a/src/webui/components/DetailSidebar/styles.js b/src/webui/components/DetailSidebar/styles.js deleted file mode 100644 index 0cdcde222..000000000 --- a/src/webui/components/DetailSidebar/styles.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @prettier - * @flow - */ - -import styled from 'react-emotion'; -import colors from '../../utils/styles/colors'; - -export const Content = styled.div` - && { - padding: 10px; - background-color: ${colors.white}; - } -`; diff --git a/src/webui/components/Developers/index.js b/src/webui/components/Developers/index.js index 27c8d89c5..26e6fd9ae 100644 --- a/src/webui/components/Developers/index.js +++ b/src/webui/components/Developers/index.js @@ -1,11 +1,12 @@ import React, {Component} from 'react'; -import { DetailContextConsumer } from '../../pages/version'; -import Card from '@material-ui/core/Card'; import Avatar from '@material-ui/core/Avatar'; import Tooltip from '@material-ui/core/Tooltip'; import Add from '@material-ui/icons/Add'; -import { Details, Heading, Content, CardContent, Fab } from './styles'; + +import { DetailContextConsumer } from '../../pages/version'; + +import { Details, Heading, Content, Fab } from './styles'; interface Props { type: 'contributors' | 'maintainers' @@ -17,8 +18,6 @@ class Developers extends Component { }; render() { - const { visibleDevs } = this.state; - console.log('aqui', visibleDevs); return ( {({ packageMeta }) => { @@ -31,27 +30,30 @@ class Developers extends Component { ); }; + handleLoadMore = () => { + this.setState((prev) => ({ visibleDevs: prev.visibleDevs + 6 })); + } + renderDevelopers = (developers) => { const { type } = this.props; const { visibleDevs } = this.state; return ( - - - {type} - - {developers.slice(0, visibleDevs).map(developer => ( -
{this.renderDeveloperDetails(developer)}
- ))} - {visibleDevs < developers.length && - - } -
-
-
+ <> + {type} + + {developers.slice(0, visibleDevs).map(developer => ( +
{this.renderDeveloperDetails(developer)}
+ ))} + {visibleDevs < developers.length && + + } +
+ ); } - renderDeveloperDetails= ({name, avatar }) => { + + renderDeveloperDetails = ({ name, avatar }) => { return ( @@ -59,10 +61,6 @@ class Developers extends Component { ); } - handleLoadMore = () => { - this.setState((prev) => ({ visibleDevs: prev.visibleDevs + 6 })); - } - } diff --git a/src/webui/components/Developers/styles.js b/src/webui/components/Developers/styles.js index 3c89c0fb4..5a872a82d 100644 --- a/src/webui/components/Developers/styles.js +++ b/src/webui/components/Developers/styles.js @@ -7,8 +7,6 @@ import Typography from '@material-ui/core/Typography'; import { default as MuiFab } from '@material-ui/core/Fab'; import colors from '../../utils/styles/colors'; -import { default as MuiCardContent } from '@material-ui/core/CardContent/index'; - export const Details = styled('span')` display: flex; flex-direction: column; @@ -16,7 +14,7 @@ export const Details = styled('span')` `; export const Content = styled('div')` - margin: -5px; + margin: 10px; display: flex; flex-wrap: wrap; > * { @@ -24,12 +22,6 @@ export const Content = styled('div')` } `; -export const CardContent = styled(MuiCardContent)` - && { - padding-bottom: 20px; - } -`; - export const Heading = styled(Typography)` && { font-weight: 700; diff --git a/src/webui/components/Install/index.js b/src/webui/components/Install/index.js index 44a16d2be..af340aa74 100644 --- a/src/webui/components/Install/index.js +++ b/src/webui/components/Install/index.js @@ -1,13 +1,14 @@ -import React, {Component} from 'react'; +import React, { Component } from 'react'; + +import List from '@material-ui/core/List'; +import ListItemText from '@material-ui/core/ListItemText'; import { DetailContextConsumer } from '../../pages/version/index'; -import Card from '@material-ui/core/Card/index'; -import CardContent from '@material-ui/core/CardContent/index'; import CopyToClipBoard from '../CopyToClipBoard'; -import Button from '@material-ui/core/Button'; -import CardActions from '@material-ui/core/CardActions'; -class Install extends Component { +import { Heading, InstallItem, PackageMangerAvatar } from './styles'; + +class Install extends Component { render() { return ( @@ -18,29 +19,35 @@ class Install extends Component { ); }; - renderCopyCLI = ({packageName}) => { + renderCopyCLI = ({ packageName }) => { return ( - - - - - - - {this.renderDownloadButton()} - - - + <> + {'Installation'}}> + {this.renderListItems(packageName)} + + ); } - renderDownloadButton = () => { + renderListItems = (packageName) => { return ( - + <> + + + } secondary={'Install using NPM'} /> + + + + } secondary={'Install using Yarn'} /> + + + + } secondary={'Install using PNPM'} /> + + ); } + } - export default Install; diff --git a/src/webui/components/Install/styles.js b/src/webui/components/Install/styles.js new file mode 100644 index 000000000..6d09aeae4 --- /dev/null +++ b/src/webui/components/Install/styles.js @@ -0,0 +1,29 @@ +/** + * @prettier + * @flow + */ + +import styled from 'react-emotion'; +import Typography from '@material-ui/core/Typography'; +import ListItem from '@material-ui/core/ListItem'; +import Avatar from '@material-ui/core/Avatar'; + +export const Heading = styled(Typography)` + && { + font-weight: 700; + text-transform: capitalize; + } +`; + +export const InstallItem = styled(ListItem)` + && { + padding-top: 0px; + padding-bottom: 0px; + } +`; + +export const PackageMangerAvatar = styled(Avatar)` + && { + border-radius: 0px; + } +`; diff --git a/src/webui/components/License/index.js b/src/webui/components/License/index.js index f7c3c4c5f..82e7f80b7 100644 --- a/src/webui/components/License/index.js +++ b/src/webui/components/License/index.js @@ -1,48 +1,47 @@ -/* eslint no-unused-vars: 0 */ +import React, {Component} from 'react'; -import React, {Component, Fragment} from 'react'; +import Avatar from '@material-ui/core/Avatar'; +import List from '@material-ui/core/List'; +import ListItem from '@material-ui/core/ListItem'; +import ListItemText from '@material-ui/core/ListItemText'; +import NotesIcon from '@material-ui/icons/Notes'; import { DetailContextConsumer } from '../../pages/version/index'; -import Card from '@material-ui/core/Card/index'; -import CardContent from '@material-ui/core/CardContent/index'; -import Avatar from '@material-ui/core/Avatar'; -import Notes from '@material-ui/icons/Notes'; -import Typography from "@material-ui/core/Typography/index"; -class License extends Component { +import { Heading } from './styles'; + +class License extends Component { render() { return ( {(context) => { - return this.renderAuthor(context); + return this.renderLicense(context); }} ); }; - renderAuthor = ({packageMeta}) => { + renderLicense = ({packageMeta}) => { const { license } = packageMeta.latest; if (!license) { return null; } return ( - - - {this.renderLicense(license)} - - + {'License'}}> + {this.renderListItems(license)} + ); } - renderLicense = (license) => { + renderListItems = (license) => { return ( - - - - {license} - - + + + + + + ); } } diff --git a/src/webui/components/License/styles.js b/src/webui/components/License/styles.js new file mode 100644 index 000000000..9160f9683 --- /dev/null +++ b/src/webui/components/License/styles.js @@ -0,0 +1,14 @@ +/** + * @prettier + * @flow + */ + +import styled from 'react-emotion'; +import Typography from '@material-ui/core/Typography'; + +export const Heading = styled(Typography)` + && { + font-weight: 700; + text-transform: capitalize; + } +`; diff --git a/src/webui/components/Repository/index.js b/src/webui/components/Repository/index.js index ded02165f..9e68c1442 100644 --- a/src/webui/components/Repository/index.js +++ b/src/webui/components/Repository/index.js @@ -1,61 +1,46 @@ -/* eslint no-unused-vars: 0 */ /* eslint react/jsx-max-depth: 0 */ -import React, {Component, Fragment} from 'react'; +import React, {Component} from 'react'; +import Avatar from '@material-ui/core/Avatar'; +import List from '@material-ui/core/List'; +import ListItem from '@material-ui/core/ListItem'; +import ListItemText from '@material-ui/core/ListItemText'; import { DetailContextConsumer } from '../../pages/version/index'; -import Card from '@material-ui/core/Card/index'; -import CardContent from '@material-ui/core/CardContent/index'; -import Grid from '@material-ui/core/Grid/index'; -import GitHub from '../../icons/GitHub'; import CopyToClipBoard from '../CopyToClipBoard'; -import BugReport from '@material-ui/icons/BugReport'; -import CardActions from '@material-ui/core/CardActions/index'; -import Button from '@material-ui/core/Button'; -import {GridRepo} from './styles'; +import Github from '../../icons/GitHub'; + +import {Heading} from './styles'; class Repository extends Component { render() { return ( {(context) => { - return this.renderAuthor(context); + return this.renderRepository(context); }} ); }; - renderAuthor = ({packageMeta}) => { - const { repository, bugs } = packageMeta.latest; + renderRepository = ({packageMeta}) => { + const { repository } = packageMeta.latest; if (!repository) { return null; } + const { url } = repository; return ( - - - - {this.renderRepository(repository, bugs)} - - - - - - - - ); - } - - renderRepository = ({url, type}, bugs) => { - return ( - - - - - - - - + <> + {'Repository'}}> + + + + + {url}} />} /> + + + ); } } diff --git a/src/webui/components/Repository/styles.js b/src/webui/components/Repository/styles.js index 8533347d5..1f59d85c0 100644 --- a/src/webui/components/Repository/styles.js +++ b/src/webui/components/Repository/styles.js @@ -5,6 +5,14 @@ import styled from 'react-emotion'; import Grid from '@material-ui/core/Grid/index'; +import Typography from '@material-ui/core/Typography'; + +export const Heading = styled(Typography)` + && { + font-weight: 700; + text-transform: capitalize; + } +`; export const GridRepo = styled(Grid)` && {