diff --git a/examples/catalog/__tests__/components/search/Item.test.tsx b/examples/catalog/__tests__/components/search/Item.test.tsx deleted file mode 100644 index 30b41b1e..00000000 --- a/examples/catalog/__tests__/components/search/Item.test.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import React from 'react'; -import renderer from 'react-test-renderer'; -import Item from '../../../components/search/Item'; - -test('📸 of Input component with empty', () => { - const fixture = { - name: 'qw', - title: '12', - organization: null, - __typename: 'Package', - }; - const tree = renderer - .create() - .toJSON(); - expect(tree).toMatchSnapshot(); -}); diff --git a/examples/catalog/__tests__/components/search/__snapshots__/Item.test.tsx.snap b/examples/catalog/__tests__/components/search/__snapshots__/Item.test.tsx.snap deleted file mode 100644 index f3c5230e..00000000 --- a/examples/catalog/__tests__/components/search/__snapshots__/Item.test.tsx.snap +++ /dev/null @@ -1,31 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`📸 of Input component with empty 1`] = ` -
-

- - 12 - -

- - dataset - -
-
-`; diff --git a/examples/catalog/components/org/About.tsx b/examples/catalog/components/org/About.tsx new file mode 100644 index 00000000..13cba08d --- /dev/null +++ b/examples/catalog/components/org/About.tsx @@ -0,0 +1,154 @@ +import { useQuery } from '@apollo/react-hooks'; +import * as timeago from 'timeago.js'; +import { ErrorMessage } from '../_shared'; +import { GET_ORG_QUERY } from '../../graphql/queries'; + +const About: React.FC<{ variables: any }> = ({ variables }) => { + const { loading, error, data } = useQuery(GET_ORG_QUERY, { + variables, + // Setting this value to true will make the component rerender when + // the "networkStatus" changes, so we are able to know if it is fetching + // more data + notifyOnNetworkStatusChange: true, + }); + + if (error) return ; + if (loading) return
Loading
; + + const { result } = data.org; + + return ( +
+
+
+ + ); +}; + +export default About; diff --git a/examples/catalog/pages/[org]/index.tsx b/examples/catalog/pages/[org]/index.tsx new file mode 100644 index 00000000..79d5c867 --- /dev/null +++ b/examples/catalog/pages/[org]/index.tsx @@ -0,0 +1,49 @@ +import { GetServerSideProps } from 'next'; +import { useQuery } from '@apollo/react-hooks'; +import Head from 'next/head'; +import { initializeApollo } from '../../lib/apolloClient'; +import Nav from '../../components/home/Nav'; +import About from '../../components/org/About'; +import Footer from '../../components/home/Footer'; +import { GET_ORG_QUERY } from '../../graphql/queries'; + +const Org: React.FC<{ variables: any }> = ({ variables }) => { + const { data, loading } = useQuery(GET_ORG_QUERY, { variables }); + + if (loading) return
Loading
; + + const { result } = data.org; + + return ( + <> + + Portal | {result.title || result.name} + + +