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

List Component - Introduced ForwardRef #181

Merged
merged 6 commits into from
Oct 12, 2019
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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 src/components/ActionBar/ActionBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import React, { Component, ReactElement } from 'react';
import BugReportIcon from '@material-ui/icons/BugReport';
import DownloadIcon from '@material-ui/icons/CloudDownload';
import HomeIcon from '@material-ui/icons/Home';
import List from '@material-ui/core/List';

import { DetailContextConsumer, VersionPageConsumerProps } from '../../pages/Version';
import { isURL, extractFileName, downloadFile } from '../../utils/url';
import api from '../../utils/api';
import Tooltip from '../../muiComponents/Tooltip';
import List from '../../muiComponents/List';

import { Fab, ActionListItem } from './styles';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Author/Author.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { FC, useContext } from 'react';
import List from '@material-ui/core/List';

import { DetailContext } from '../../pages/Version';
import { isEmail } from '../../utils/url';
import Avatar from '../../muiComponents/Avatar';
import List from '../../muiComponents/List';

import { Heading, AuthorListItem, AuthorListItemText } from './styles';

Expand Down
2 changes: 1 addition & 1 deletion src/components/DetailSidebar/DetailSidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { ReactElement } from 'react';
import Card from '@material-ui/core/Card';
import CardContent from '@material-ui/core/CardContent';
import List from '@material-ui/core/List';

import { ActionBar } from '../ActionBar/ActionBar';
import Author from '../Author';
Expand All @@ -11,6 +10,7 @@ import Engine from '../Engines/Engines';
import Install from '../Install';
import Repository from '../Repository/Repository';
import { DetailContext } from '../../pages/Version';
import List from '../../muiComponents/List';

import { TitleListItem, TitleListItemText, PackageDescription, PackageVersion } from './styles';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Dist/Dist.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { FC, useContext } from 'react';
import List from '@material-ui/core/List';

import { DetailContext } from '../../pages/Version';
import fileSizeSI from '../../utils/file-size';
import { formatLicense } from '../../utils/package';
import List from '../../muiComponents/List';

import { Heading, DistListItem, DistChips } from './styles';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Engines/Engines.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { Component, ReactElement } from 'react';
import Grid from '@material-ui/core/Grid';
import List from '@material-ui/core/List';
import ListItemText from '@material-ui/core/ListItemText';

import { VersionPageConsumerProps, DetailContextConsumer } from '../../pages/Version';
import Avatar from '../../muiComponents/Avatar';
import List from '../../muiComponents/List';
import npm from '../Install/img/npm.svg';

import { Heading, EngineListItem } from './styles';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Install/Install.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useContext } from 'react';
import styled from 'react-emotion';
import Typography from '@material-ui/core/Typography';
import List from '@material-ui/core/List';

import { DetailContext } from '../../pages/Version';
import { fontWeight } from '../../utils/styles/sizes';
import List from '../../muiComponents/List';

import InstallListItem, { DependencyManager } from './InstallListItem';

Expand Down
40 changes: 40 additions & 0 deletions src/components/NotFound/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { default as MuiCard } from '@material-ui/core/Card';
import Typography from '@material-ui/core/Typography';
import styled from 'react-emotion';

import List from '../../muiComponents/List';

export const Wrapper = styled('div')({
display: 'flex',
alignItems: 'center',
flexDirection: 'column',
justifyContent: 'center',
flex: 1,
padding: '16px',
});

export const Inner = styled('div')({
maxWidth: '650px',
display: 'flex',
flexDirection: 'column',
});

export const EmptyPackage = styled('img')({
width: '150px',
margin: '0 auto',
});

export const Heading = styled(Typography)({
'&&': {
color: '#4b5e40',
},
});

export const StyledList = styled(List)({
padding: 0,
color: '#4b5e40',
});

export const Card = styled(MuiCard)({
marginTop: '24px',
});
2 changes: 1 addition & 1 deletion src/components/Package/styles.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import styled from 'react-emotion';
import { Link } from 'react-router-dom';
import Grid from '@material-ui/core/Grid';
import List from '@material-ui/core/List';
import ListItemText from '@material-ui/core/ListItemText';
import Typography from '@material-ui/core/Typography';

Expand All @@ -12,6 +11,7 @@ import colors from '../../utils/styles/colors';
import { fontWeight } from '../../utils/styles/sizes';
import { default as MuiIconButton } from '../../muiComponents/IconButton';
import { default as Photo } from '../../muiComponents/Avatar';
import List from '../../muiComponents/List';

export const OverviewItem = styled('span')`
&& {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Repository/Repository.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* eslint react/jsx-max-depth: 0 */

import List from '@material-ui/core/List';
import React, { Component, Fragment, ReactElement } from 'react';

import Avatar from '../../muiComponents/Avatar';
import { DetailContextConsumer } from '../../pages/Version';
import { isURL } from '../../utils/url';
import CopyToClipBoard from '../CopyToClipBoard';
import List from '../../muiComponents/List';

import git from './img/git.png';
import { GithubLink, Heading, RepositoryListItem, RepositoryListItemText } from './styles';
Expand Down
2 changes: 1 addition & 1 deletion src/components/UpLinks/UpLinks.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useContext } from 'react';
import List from '@material-ui/core/List';

import { DetailContext } from '../../pages/Version';
import NoItems from '../NoItems';
import { formatDateDistance } from '../../utils/package';
import List from '../../muiComponents/List';
import ListItem from '../../muiComponents/ListItem';

import { Heading, Spacer, ListItemText } from './styles';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Versions/VersionsHistoryList.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import List from '@material-ui/core/List';
import Link from '@material-ui/core/Link';
import { Link as RouterLink } from 'react-router-dom';

import { Versions, Time } from '../../../types/packageMeta';
import { formatDateDistance } from '../../utils/package';
import List from '../../muiComponents/List';
import ListItem from '../../muiComponents/ListItem';

import { Spacer, ListItemText } from './styles';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Versions/VersionsTagList.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import List from '@material-ui/core/List';

import { DistTags } from '../../../types/packageMeta';
import ListItem from '../../muiComponents/ListItem';
import List from '../../muiComponents/List';

import { Spacer, ListItemText } from './styles';

Expand Down
10 changes: 10 additions & 0 deletions src/muiComponents/List/List.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React, { forwardRef } from 'react';
import { default as MaterialUIList, ListProps } from '@material-ui/core/List';

type ListRef = HTMLUListElement;

const List = forwardRef<ListRef, ListProps>(function List(props, ref) {
return <MaterialUIList {...props} ref={ref} />;
});

export default List;
1 change: 1 addition & 0 deletions src/muiComponents/List/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './List';