[refactor][x]: move reusable ErrorMessage component to _shared
This commit is contained in:
@@ -24,7 +24,8 @@ const Table: React.FC<TableProps> = ({ columns, data, className }) => {
|
|||||||
{columns.map(({ key, render }) => (
|
{columns.map(({ key, render }) => (
|
||||||
<td className="px-4 py-2">
|
<td className="px-4 py-2">
|
||||||
{(render && typeof render === 'function' && render(item)) ||
|
{(render && typeof render === 'function' && render(item)) ||
|
||||||
item[key]}
|
item[key] ||
|
||||||
|
''}
|
||||||
</td>
|
</td>
|
||||||
))}
|
))}
|
||||||
</tr>
|
</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 Link from 'next/link';
|
||||||
import { useQuery } from '@apollo/react-hooks';
|
import { useQuery } from '@apollo/react-hooks';
|
||||||
import ErrorMessage from '../Error';
|
import { ErrorMessage } from '../_shared';
|
||||||
import { GET_ORG_QUERY } from '../../graphql/queries';
|
import { GET_ORG_QUERY } from '../../graphql/queries';
|
||||||
|
|
||||||
export default function Org({ variables }) {
|
export default function Org({ variables }) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { useQuery } from '@apollo/react-hooks';
|
import { useQuery } from '@apollo/react-hooks';
|
||||||
import ErrorMessage from '../Error';
|
import { ErrorMessage } from '../_shared';
|
||||||
import { SEARCH_QUERY } from '../../graphql/queries';
|
import { SEARCH_QUERY } from '../../graphql/queries';
|
||||||
|
|
||||||
function Recent() {
|
function Recent() {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useQuery } from '@apollo/react-hooks';
|
import { useQuery } from '@apollo/react-hooks';
|
||||||
import ErrorMessage from '../Error';
|
import { ErrorMessage } from '../_shared';
|
||||||
import { GET_RESOURCES_QUERY } from '../../graphql/queries';
|
import { GET_RESOURCES_QUERY } from '../../graphql/queries';
|
||||||
|
|
||||||
export default function DataExplorer({ variables }) {
|
export default function DataExplorer({ variables }) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useQuery } from '@apollo/react-hooks';
|
import { useQuery } from '@apollo/react-hooks';
|
||||||
import Item from './Item';
|
import Item from './Item';
|
||||||
import ErrorMessage from '../Error';
|
import { ErrorMessage } from '../_shared';
|
||||||
import { SEARCH_QUERY } from '../../graphql/queries';
|
import { SEARCH_QUERY } from '../../graphql/queries';
|
||||||
|
|
||||||
export default function List({ variables }) {
|
export default function List({ variables }) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useQuery } from '@apollo/react-hooks';
|
import { useQuery } from '@apollo/react-hooks';
|
||||||
import ErrorMessage from '../Error';
|
import { ErrorMessage } from '../_shared';
|
||||||
import { GET_TOTAL_COUNT_QUERY } from '../../graphql/queries';
|
import { GET_TOTAL_COUNT_QUERY } from '../../graphql/queries';
|
||||||
|
|
||||||
export default function Total({ variables }) {
|
export default function Total({ variables }) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import parse from 'html-react-parser';
|
import parse from 'html-react-parser';
|
||||||
import { useQuery } from '@apollo/react-hooks';
|
import { useQuery } from '@apollo/react-hooks';
|
||||||
import ErrorMessage from '../Error';
|
import { ErrorMessage } from '../_shared';
|
||||||
import { GET_POSTS_QUERY } from '../../graphql/queries';
|
import { GET_POSTS_QUERY } from '../../graphql/queries';
|
||||||
|
|
||||||
export default function List() {
|
export default function List() {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import parse from 'html-react-parser';
|
import parse from 'html-react-parser';
|
||||||
import { useQuery } from '@apollo/react-hooks';
|
import { useQuery } from '@apollo/react-hooks';
|
||||||
import ErrorMessage from '../Error';
|
import { ErrorMessage } from '../_shared';
|
||||||
import { GET_PAGE_QUERY } from '../../graphql/queries';
|
import { GET_PAGE_QUERY } from '../../graphql/queries';
|
||||||
|
|
||||||
export default function Page({ variables }) {
|
export default function Page({ variables }) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import parse from 'html-react-parser';
|
import parse from 'html-react-parser';
|
||||||
import { useQuery } from '@apollo/react-hooks';
|
import { useQuery } from '@apollo/react-hooks';
|
||||||
import ErrorMessage from '../Error';
|
import { ErrorMessage } from '../_shared';
|
||||||
import { GET_PAGE_QUERY } from '../../graphql/queries';
|
import { GET_PAGE_QUERY } from '../../graphql/queries';
|
||||||
|
|
||||||
export default function Post({ variables }) {
|
export default function Post({ variables }) {
|
||||||
|
|||||||
Reference in New Issue
Block a user