[refactor][x]: move reusable ErrorMessage component to _shared
This commit is contained in:
parent
a82325b91a
commit
ff134a02f9
@ -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>
|
||||
|
||||
4
components/_shared/index.ts
Normal file
4
components/_shared/index.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import Table from './Table';
|
||||
import ErrorMessage from './Error';
|
||||
|
||||
export { Table, ErrorMessage };
|
||||
@ -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 }) {
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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 }) {
|
||||
|
||||
@ -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 }) {
|
||||
|
||||
@ -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 }) {
|
||||
|
||||
@ -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() {
|
||||
|
||||
@ -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 }) {
|
||||
|
||||
@ -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 }) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user