Skip to content
This repository has been archived by the owner on Jan 16, 2022. It is now read-only.

Chore: Migrate Material UI Dependencies to version 4.X.X #90

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,4 @@
"browser": true,
"jest/globals": true
}
}
}
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
"devDependencies": {
"@commitlint/cli": "8.0.0",
"@commitlint/config-conventional": "8.0.0",
"@material-ui/core": "3.9.3",
"@material-ui/icons": "3.0.2",
"@material-ui/core": "4.2.0",
"@material-ui/icons": "4.2.1",
"@octokit/rest": "16.23.2",
"@types/enzyme": "3.9.3",
"@types/enzyme": "3.10.1",
"@types/lodash": "4.14.134",
"@types/material-ui": "0.21.6",
"@types/node": "12.0.8",
"@types/react": "16.8.16",
"@types/react-dom": "16.8.4",
Expand Down
2 changes: 1 addition & 1 deletion src/components/ActionBar/styles.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import styled from 'react-emotion';
import { default as MuiFab } from '@material-ui/core/Fab';
import ListItem from '@material-ui/core/ListItem';

import colors from '../../utils/styles/colors';
import ListItem from '../ListItem';

export const ActionListItem = styled(ListItem)`
&& {
Expand Down
5 changes: 3 additions & 2 deletions src/components/Author/Author.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
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/Version';
import { Heading, AuthorListItem } from './styles';
import { isEmail } from '../../utils/url';

import Avatar from '../primitives/Avatar';

class Authors extends Component {
public render(): ReactElement<HTMLElement> {
return (
Expand Down Expand Up @@ -40,7 +41,7 @@ class Authors extends Component {

const avatarComponent = <Avatar alt={author.name} src={author.avatar} />;
return (
<List subheader={<Heading variant={'subheading'}>{'Author'}</Heading>}>
<List subheader={<Heading variant={'subtitle1'}>{'Author'}</Heading>}>
<AuthorListItem>
{this.renderLinkForMail(author.email, avatarComponent, packageName, version)}
<ListItemText primary={author.name} />
Expand Down
47 changes: 44 additions & 3 deletions src/components/Author/__snapshots__/Author.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,46 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<Author /> component should render the component in default state 1`] = `"<ul class=\\"MuiList-root-1 MuiList-padding-2 MuiList-subheader-4\\"><h3 class=\\"MuiTypography-root-5 MuiTypography-subheading-12 css-hyrz44 e1xuehjw0\\">Author</h3><li class=\\"MuiListItem-root-41 MuiListItem-default-44 MuiListItem-gutters-49 css-z8a2h0 e1xuehjw1\\"><a href=\\"mailto:[email protected][email protected]\\" target=\\"_top\\"><div class=\\"MuiAvatar-root-53\\"><img alt=\\"verdaccio user\\" src=\\"https://www.gravatar.com/avatar/000000\\" class=\\"MuiAvatar-img-55\\"/></div></a><div class=\\"MuiListItemText-root-56\\"><span class=\\"MuiTypography-root-5 MuiTypography-subheading-12 MuiListItemText-primary-59\\">verdaccio user</span></div></li></ul>"`;

exports[`<Author /> component should render the component when there is no author email 1`] = `"<ul class=\\"MuiList-root-62 MuiList-padding-63 MuiList-subheader-65\\"><h3 class=\\"MuiTypography-root-66 MuiTypography-subheading-73 css-hyrz44 e1xuehjw0\\">Author</h3><li class=\\"MuiListItem-root-102 MuiListItem-default-105 MuiListItem-gutters-110 css-z8a2h0 e1xuehjw1\\"><div class=\\"MuiAvatar-root-114\\"><img alt=\\"verdaccio user\\" src=\\"https://www.gravatar.com/avatar/000000\\" class=\\"MuiAvatar-img-116\\"/></div><div class=\\"MuiListItemText-root-117\\"><span class=\\"MuiTypography-root-66 MuiTypography-subheading-73 MuiListItemText-primary-120\\">verdaccio user</span></div></li></ul>"`;
exports[`<Author /> component should render the component when there is no author email 1`] = `
Authors {
"context": Object {},
"props": Object {},
"refs": Object {},
"renderAuthor": [Function],
"setState": [Function],
"state": null,
"updater": Updater {
"_callbacks": Array [],
"_renderer": ReactShallowRenderer {
"_context": Object {},
"_didScheduleRenderPhaseUpdate": false,
"_dispatcher": Object {
"readContext": [Function],
"useCallback": [Function],
"useContext": [Function],
"useDebugValue": [Function],
"useEffect": [Function],
"useImperativeHandle": [Function],
"useLayoutEffect": [Function],
"useMemo": [Function],
"useReducer": [Function],
"useRef": [Function],
"useState": [Function],
},
"_element": <Authors />,
"_firstWorkInProgressHook": null,
"_forcedUpdate": false,
"_instance": [Circular],
"_isReRender": false,
"_newState": null,
"_numberOfReRenders": 0,
"_renderPhaseUpdates": null,
"_rendered": <DetailContextConsumer>
[Function]
</DetailContextConsumer>,
"_rendering": false,
"_updater": [Circular],
"_workInProgressHook": null,
},
},
}
`;
3 changes: 2 additions & 1 deletion src/components/Author/styles.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import styled from 'react-emotion';
import ListItem from '@material-ui/core/ListItem';
import Typography from '@material-ui/core/Typography';

import ListItem from '../ListItem';

export const Heading = styled(Typography)`
&& {
font-weight: 700;
Expand Down
4 changes: 2 additions & 2 deletions src/components/AutoComplete/AutoComplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const renderSuggestion = (suggestion, { query, isHighlighted }): JSX.Element =>
const matches = match(suggestion.name, query);
const parts = parse(suggestion.name, matches);
return (
<MenuItem component="div" selected={isHighlighted}>
<MenuItem component={'div'} selected={isHighlighted}>
<div>
{parts.map((part, index) => {
const fw = part.highlight ? fontWeight.semiBold : fontWeight.light;
Expand All @@ -73,7 +73,7 @@ const renderSuggestion = (suggestion, { query, isHighlighted }): JSX.Element =>

const renderMessage = (message): JSX.Element => {
return (
<MenuItem component="div" selected={false}>
<MenuItem component={'div'} selected={false}>
<div>{message}</div>
</MenuItem>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<CopyToClipBoard /> component render the component 1`] = `"<div class=\\"css-1mta3t8 eb8w2fo0\\"><span class=\\"css-1m8aenu eb8w2fo1\\">copy text</span><button class=\\"MuiButtonBase-root-15 MuiIconButton-root-9 css-56v3u0 eb8w2fo2\\" tabindex=\\"0\\" type=\\"button\\" title=\\"Copy to Clipboard\\"><span class=\\"MuiIconButton-label-14\\"><svg class=\\"MuiSvgIcon-root-18\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path fill=\\"none\\" d=\\"M0 0h24v24H0z\\"></path><path d=\\"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4l6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z\\"></path></svg></span></button></div>"`;
exports[`<CopyToClipBoard /> component render the component 1`] = `"<div class=\\"css-1mta3t8 eb8w2fo0\\"><span class=\\"css-1m8aenu eb8w2fo1\\">copy text</span><button class=\\"MuiButtonBase-root MuiIconButton-root css-56v3u0 eb8w2fo2\\" tabindex=\\"0\\" type=\\"button\\" title=\\"Copy to Clipboard\\"><span class=\\"MuiIconButton-label\\"><svg class=\\"MuiSvgIcon-root\\" focusable=\\"false\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" role=\\"presentation\\"><path d=\\"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4l6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2h7zm-1 7h5.5L14 6.5V12z\\"></path></svg></span></button></div>"`;
3 changes: 2 additions & 1 deletion src/components/CopyToClipBoard/styles.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import IconButton from '@material-ui/core/IconButton';
import styled from 'react-emotion';

import IconButton from '../primitives/IconButton';

export const ClipBoardCopy = styled('div')`
&& {
display: flex;
Expand Down
8 changes: 4 additions & 4 deletions src/components/Dependencies/Dependencies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class DepDetail extends Component<DepDetailProps, DepDetailState> {
public render(): ReactElement<HTMLElement> {
const { name, version } = this.state;
const tagText = `${name}@${version}`;
return <Tag className={'dep-tag'} clickable={true} component={'div'} label={tagText} onClick={this.handleOnClick} />;
return <Tag className={'dep-tag'} clickable={true} label={tagText} onClick={this.handleOnClick} />;
}

private handleOnClick = () => {
Expand All @@ -57,7 +57,7 @@ class DependencyBlock extends Component<{ title: string; dependencies: [] }> {
return (
<CardWrap>
<CardContent>
<Heading variant="subheading">{`${title} (${deps.length})`}</Heading>
<Heading variant={'subtitle1'}>{`${title} (${deps.length})`}</Heading>
<Tags>{this.renderTags(deps, enableLoading)}</Tags>
</CardContent>
</CardWrap>
Expand Down Expand Up @@ -104,15 +104,15 @@ class Dependencies extends Component {
const selectedDepndency = dependencyMap[value];
if (selectedDepndency && this.checkDependencyLength(selectedDepndency)) {
// @ts-ignore
result.push(<DependencyBlock className="dependency-block" dependencies={selectedDepndency} key={key} title={value} />);
result.push(<DependencyBlock className={'dependency-block'} dependencies={selectedDepndency} key={key} title={value} />);
}
return result;
}, []);

if (dependencyList.length) {
return <Fragment>{dependencyList}</Fragment>;
}
return <NoItems className="no-dependencies" text={`${name} has no dependencies.`} />;
return <NoItems className={'no-dependencies'} text={`${name} has no dependencies.`} />;
}
}

Expand Down
16 changes: 8 additions & 8 deletions src/components/DetailSidebar/DetailSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import CardContent from '@material-ui/core/CardContent';
import List from '@material-ui/core/List';

import ActionBar from '../ActionBar/ActionBar';
import Author from '../Author';
import Authors from '../Author';
import Developers from '../Developers';
import Dist from '../Dist/Dist';
import Engine from '../Engines/Engines';
Expand All @@ -32,7 +32,7 @@ class DetailSidebar extends Component {
{this.renderRepository()}
{this.renderEngine()}
{this.renderDist()}
{this.renderAuthor()}
{this.renderAuthors()}
{this.renderMaintainers()}
{this.renderContributors()}
</CardContent>
Expand All @@ -43,8 +43,8 @@ class DetailSidebar extends Component {

private renderTitle = (packageName, packageMeta) => {
return (
<List className="detail-info">
<TitleListItem alignItems="flex-start">
<List className={'detail-info'}>
<TitleListItem alignItems={'flex-start'}>
<TitleListItemText primary={<b>{packageName}</b>} secondary={packageMeta.latest.description} />
</TitleListItem>
</List>
Expand All @@ -56,19 +56,19 @@ class DetailSidebar extends Component {
};

private renderMaintainers = () => {
return <Developers type="maintainers" />;
return <Developers type={'maintainers'} />;
};

private renderContributors = () => {
return <Developers type="contributors" />;
return <Developers type={'contributors'} />;
};

private renderRepository = () => {
return <Repository />;
};

private renderAuthor = () => {
return <Author />;
private renderAuthors = () => {
return <Authors />;
};

private renderEngine = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/DetailSidebar/styles.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import styled from 'react-emotion';
import Avatar from '@material-ui/core/Avatar';
import ListItem from '@material-ui/core/ListItem';
import ListItemText from '@material-ui/core/ListItemText';

import colors from '../../utils/styles/colors';
import ListItem from '../ListItem';

export const TitleListItem = styled(ListItem)`
&& {
Expand Down
7 changes: 4 additions & 3 deletions src/components/Developers/Developers.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React, { Component } from 'react';

import Avatar from '@material-ui/core/Avatar';
import Add from '@material-ui/icons/Add';
import Tooltip from '@material-ui/core/Tooltip';

import { DetailContextConsumer } from '../../pages/version/Version';
import { Details, Heading, Content, Fab } from './styles';
import { isEmail } from '../../utils/url';

import Avatar from '../primitives/Avatar';

interface Props {
type: 'contributors' | 'maintainers';
}
Expand Down Expand Up @@ -42,13 +43,13 @@ class Developers extends Component<Props, State> {
const { visibleDevs } = this.state;
return (
<>
<Heading variant={'subheading'}>{type}</Heading>
<Heading variant={'subtitle1'}>{type}</Heading>
<Content>
{developers.slice(0, visibleDevs).map(developer => (
<Details key={developer.email}>{this.renderDeveloperDetails(developer, packageMeta)}</Details>
))}
{visibleDevs < developers.length && (
<Fab onClick={this.handleLoadMore} size="small">
<Fab onClick={this.handleLoadMore} size={'small'}>
<Add />
</Fab>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dist/Dist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Dist extends Component {
const { dist, license } = packageMeta && packageMeta.latest;

return (
<List subheader={<Heading variant="subheading">{'Latest Distribution'}</Heading>}>
<List subheader={<Heading variant={'subtitle1'}>{'Latest Distribution'}</Heading>}>
<DistListItem>{this.renderChips(dist, license)}</DistListItem>
</List>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dist/styles.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import styled from 'react-emotion';
import { default as MuiFab } from '@material-ui/core/Fab';
import Chip from '@material-ui/core/Chip';
import ListItem from '@material-ui/core/ListItem';
import Typography from '@material-ui/core/Typography';

import colors from '../../utils/styles/colors';
import ListItem from '../ListItem';

export const Heading = styled(Typography)`
&& {
Expand Down
5 changes: 3 additions & 2 deletions src/components/Engines/Engines.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React, { Component, ReactElement } from 'react';

import Avatar from '@material-ui/core/Avatar';
import Grid from '@material-ui/core/Grid';
import List from '@material-ui/core/List';
import ListItemText from '@material-ui/core/ListItemText';

import Avatar from '../primitives/Avatar';

import { DetailContextConsumer, VersionPageConsumerProps } from '../../pages/version/Version';
import { Heading, EngineListItem } from './styles';
// @ts-ignore
Expand Down Expand Up @@ -60,7 +61,7 @@ class Engine extends Component {

private renderListItems = (heading, text) => {
return (
<List subheader={<Heading variant={'subheading'}>{text.split('-').join(' ')}</Heading>}>
<List subheader={<Heading variant={'subtitle1'}>{text.split('-').join(' ')}</Heading>}>
<EngineListItem>
{ICONS[text]}
<ListItemText primary={heading} />
Expand Down
3 changes: 2 additions & 1 deletion src/components/Engines/styles.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import styled from 'react-emotion';
import ListItem from '@material-ui/core/ListItem';
import Typography from '@material-ui/core/Typography';

import ListItem from '../ListItem';

export const Heading = styled(Typography)`
&& {
font-weight: 700;
Expand Down
16 changes: 8 additions & 8 deletions src/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { goToVerdaccioWebsite } from '../../utils/windows';

const renderTooltip = (): JSX.Element => (
<ToolTip>
<Earth name="earth" size="md" />
<Earth name={'earth'} size={'md'} />
<Flags>
<Flag name="spain" size="md" />
<Flag name="nicaragua" size="md" />
<Flag name="india" size="md" />
<Flag name="brazil" size="md" />
<Flag name="china" size="md" />
<Flag name="austria" size="md" />
<Flag name={'spain'} size={'md'} />
<Flag name={'nicaragua'} size={'md'} />
<Flag name={'india'} size={'md'} />
<Flag name={'brazil'} size={'md'} />
<Flag name={'china'} size={'md'} />
<Flag name={'austria'} size={'md'} />
</Flags>
</ToolTip>
);
Expand All @@ -26,7 +26,7 @@ const renderRight = (version = window.VERDACCIO_VERSION): JSX.Element => {
return (
<Right>
{POWERED_LABEL}
<Logo img={true} name="verdaccio" onClick={goToVerdaccioWebsite} pointer={true} size="md" />
<Logo img={true} name={'verdaccio'} onClick={goToVerdaccioWebsite} pointer={true} size={'md'} />
{`/ ${version}`}
</Right>
);
Expand Down
Loading