diff --git a/app/components/file-input.js b/app/components/file-input.js index 5ed0b56..f9b3af5 100644 --- a/app/components/file-input.js +++ b/app/components/file-input.js @@ -1,4 +1,4 @@ -const FileInput = props => +const FileInput = props => (
+) export default FileInput diff --git a/app/components/page.js b/app/components/page.js index 220dd33..b306505 100644 --- a/app/components/page.js +++ b/app/components/page.js @@ -1,11 +1,9 @@ import Head from 'next/head' -const Page = ({ title, children }) => +const Page = ({ title, children }) => (
- - {title} - + {title} @@ -24,5 +22,6 @@ const Page = ({ title, children }) => {children}
+) export default Page diff --git a/app/components/table.js b/app/components/table.js index 29a8caa..9634a04 100644 --- a/app/components/table.js +++ b/app/components/table.js @@ -1,12 +1,8 @@ -export const Table = ({ thead, tbody }) => +export const Table = ({ thead, tbody }) => (
- - {thead} - - - {tbody} - + {thead} + {tbody}
+) -export const Head = ({ children }) => +export const Head = ({ children }) => ( {children} +) -export const Cell = ({ children }) => +export const Cell = ({ children }) => ( {children} +) diff --git a/app/components/upload-list.js b/app/components/upload-list.js index 58c0ef3..2f3b518 100644 --- a/app/components/upload-list.js +++ b/app/components/upload-list.js @@ -2,7 +2,7 @@ import { graphql } from 'react-apollo' import { Table, Head, Cell } from './table' import uploadsQuery from '../queries/uploads' -const UploadList = ({ data: { uploads = [] } }) => +const UploadList = ({ data: { uploads = [] } }) => ( @@ -12,22 +12,15 @@ const UploadList = ({ data: { uploads = [] } }) => Path } - tbody={uploads.map(({ id, name, type, size, path }) => + tbody={uploads.map(({ id, name, type, size, path }) => ( - - {name} - - - {type} - - - {size} - - - {path} - + {name} + {type} + {size} + {path} - )} + ))} /> +) export default graphql(uploadsQuery)(UploadList) diff --git a/app/helpers/with-data.js b/app/helpers/with-data.js index d581857..e5d1861 100644 --- a/app/helpers/with-data.js +++ b/app/helpers/with-data.js @@ -58,12 +58,11 @@ export default ComposedComponent => } // If the page component has initial props, merge them in. - if (ComposedComponent.getInitialProps) { + if (ComposedComponent.getInitialProps) Object.assign( initialProps.composedComponentProps, await ComposedComponent.getInitialProps(context) ) - } if (ssrMode) { const apolloClient = createApolloClient() @@ -101,10 +100,10 @@ export default ComposedComponent => constructor(props) { super(props) - if (ssrMode) { + if (ssrMode) // For the server an Apollo Client instance exists per request this.apolloClient = createApolloClient(this.props.initialState) - } else { + else { // For the client an Apollo Client instance is shared between pages if (!apolloClient) apolloClient = createApolloClient(this.props.initialState) diff --git a/app/pages/index.js b/app/pages/index.js index 6fce316..28476f4 100644 --- a/app/pages/index.js +++ b/app/pages/index.js @@ -4,11 +4,12 @@ import MultipleUploader from '../components/multiple-uploader' import UploadList from '../components/upload-list' import withData from '../helpers/with-data' -const HomePage = () => +const HomePage = () => ( +) export default withData(HomePage)