[refactor][x]: move reusable ErrorMessage component to _shared

This commit is contained in:
Tavares Hansen 2020-08-03 19:21:09 -07:00
parent a82325b91a
commit ff134a02f9
11 changed files with 14 additions and 9 deletions

View File

@ -24,7 +24,8 @@ const Table: React.FC<TableProps> = ({ columns, data, className }) => {
{columns.map(({ key, render }) => (
<td className="px-4 py-2">
{(render && typeof render === 'function' && render(item)) ||
item[key]}
item[key] ||
''}
</td>
))}
</tr>

View File

@ -0,0 +1,4 @@
import Table from './Table';
import ErrorMessage from './Error';
export { Table, ErrorMessage };

View File

@ -1,6 +1,6 @@
import Link from 'next/link';
import { useQuery } from '@apollo/react-hooks';
import ErrorMessage from '../Error';
import { ErrorMessage } from '../_shared';
import { GET_ORG_QUERY } from '../../graphql/queries';
export default function Org({ variables }) {

View File

@ -1,6 +1,6 @@
import Link from 'next/link';
import { useQuery } from '@apollo/react-hooks';
import ErrorMessage from '../Error';
import { ErrorMessage } from '../_shared';
import { SEARCH_QUERY } from '../../graphql/queries';
function Recent() {

View File

@ -1,5 +1,5 @@
import { useQuery } from '@apollo/react-hooks';
import ErrorMessage from '../Error';
import { ErrorMessage } from '../_shared';
import { GET_RESOURCES_QUERY } from '../../graphql/queries';
export default function DataExplorer({ variables }) {

View File

@ -1,6 +1,6 @@
import { useQuery } from '@apollo/react-hooks';
import Item from './Item';
import ErrorMessage from '../Error';
import { ErrorMessage } from '../_shared';
import { SEARCH_QUERY } from '../../graphql/queries';
export default function List({ variables }) {

View File

@ -1,5 +1,5 @@
import { useQuery } from '@apollo/react-hooks';
import ErrorMessage from '../Error';
import { ErrorMessage } from '../_shared';
import { GET_TOTAL_COUNT_QUERY } from '../../graphql/queries';
export default function Total({ variables }) {

View File

@ -1,6 +1,6 @@
import parse from 'html-react-parser';
import { useQuery } from '@apollo/react-hooks';
import ErrorMessage from '../Error';
import { ErrorMessage } from '../_shared';
import { GET_POSTS_QUERY } from '../../graphql/queries';
export default function List() {

View File

@ -1,6 +1,6 @@
import parse from 'html-react-parser';
import { useQuery } from '@apollo/react-hooks';
import ErrorMessage from '../Error';
import { ErrorMessage } from '../_shared';
import { GET_PAGE_QUERY } from '../../graphql/queries';
export default function Page({ variables }) {

View File

@ -1,6 +1,6 @@
import parse from 'html-react-parser';
import { useQuery } from '@apollo/react-hooks';
import ErrorMessage from '../Error';
import { ErrorMessage } from '../_shared';
import { GET_PAGE_QUERY } from '../../graphql/queries';
export default function Post({ variables }) {