mirror of
https://github.com/SomboChea/ui
synced 2026-01-19 17:46:12 +07:00
feat: update material-ui@4.x (#123)
* chore: update material-ui@4.x * test: update test for ActionBar and TestField * chore: add types * chore: update types * test: update test for Author * chore: fixed bunch of unit test * chore: remove unused import * chore: remove comments * chore: replace shallow my mount * chore: update git hooks * chore: fix styles * chore: update dependencies * chore: remove types material-ui
This commit is contained in:
committed by
GitHub
parent
376b84f8c9
commit
67d7188cf5
@@ -2,10 +2,9 @@ import React, { Component, ReactNode, ReactElement } from 'react';
|
||||
|
||||
import Avatar from '@material-ui/core/Avatar';
|
||||
import List from '@material-ui/core/List';
|
||||
import ListItemText from '@material-ui/core/ListItemText';
|
||||
|
||||
import { DetailContextConsumer } from '../../pages/Version';
|
||||
import { Heading, AuthorListItem } from './styles';
|
||||
import { Heading, AuthorListItem, AuthorListItemText } from './styles';
|
||||
import { isEmail } from '../../utils/url';
|
||||
|
||||
class Authors extends Component {
|
||||
@@ -13,7 +12,13 @@ class Authors extends Component {
|
||||
return (
|
||||
<DetailContextConsumer>
|
||||
{context => {
|
||||
return context && context.packageMeta && this.renderAuthor(context.packageMeta);
|
||||
const { packageMeta } = context;
|
||||
|
||||
if (!packageMeta) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.renderAuthor(packageMeta);
|
||||
}}
|
||||
</DetailContextConsumer>
|
||||
);
|
||||
@@ -31,8 +36,8 @@ class Authors extends Component {
|
||||
);
|
||||
}
|
||||
|
||||
public renderAuthor = packageMeta => {
|
||||
const { author, name: packageName, version } = packageMeta.latest;
|
||||
public renderAuthor = ({ latest }) => {
|
||||
const { author, name: packageName, version } = latest;
|
||||
|
||||
if (!author) {
|
||||
return null;
|
||||
@@ -40,10 +45,10 @@ class Authors extends Component {
|
||||
|
||||
const avatarComponent = <Avatar alt={author.name} src={author.avatar} />;
|
||||
return (
|
||||
<List subheader={<Heading variant={'subheading'}>{'Author'}</Heading>}>
|
||||
<AuthorListItem>
|
||||
<List subheader={<Heading variant={'subtitle1'}>{'Author'}</Heading>}>
|
||||
<AuthorListItem button={true}>
|
||||
{this.renderLinkForMail(author.email, avatarComponent, packageName, version)}
|
||||
<ListItemText primary={author.name} />
|
||||
<AuthorListItemText primary={author.name} />
|
||||
</AuthorListItem>
|
||||
</List>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user