Lint fixes.

This commit is contained in:
Jayden Seric 2017-10-02 16:56:14 +11:00
parent 8d5eb3ec11
commit 5e13f9e20e
6 changed files with 26 additions and 34 deletions

View File

@ -1,4 +1,4 @@
const FileInput = props => const FileInput = props => (
<div> <div>
<input type="file" {...props} /> <input type="file" {...props} />
<style jsx>{` <style jsx>{`
@ -7,5 +7,6 @@ const FileInput = props =>
} }
`}</style> `}</style>
</div> </div>
)
export default FileInput export default FileInput

View File

@ -1,11 +1,9 @@
import Head from 'next/head' import Head from 'next/head'
const Page = ({ title, children }) => const Page = ({ title, children }) => (
<div> <div>
<Head> <Head>
<title> <title>{title}</title>
{title}
</title>
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#22a699" /> <meta name="theme-color" content="#22a699" />
<link rel="manifest" href="/static/manifest.json" /> <link rel="manifest" href="/static/manifest.json" />
@ -24,5 +22,6 @@ const Page = ({ title, children }) =>
</Head> </Head>
{children} {children}
</div> </div>
)
export default Page export default Page

View File

@ -1,12 +1,8 @@
export const Table = ({ thead, tbody }) => export const Table = ({ thead, tbody }) => (
<div> <div>
<table> <table>
<thead> <thead>{thead}</thead>
{thead} <tbody>{tbody}</tbody>
</thead>
<tbody>
{tbody}
</tbody>
</table> </table>
<style jsx>{` <style jsx>{`
div { div {
@ -21,8 +17,9 @@ export const Table = ({ thead, tbody }) =>
} }
`}</style> `}</style>
</div> </div>
)
export const Head = ({ children }) => export const Head = ({ children }) => (
<th> <th>
{children} {children}
<style jsx>{` <style jsx>{`
@ -31,8 +28,9 @@ export const Head = ({ children }) =>
} }
`}</style> `}</style>
</th> </th>
)
export const Cell = ({ children }) => export const Cell = ({ children }) => (
<td> <td>
{children} {children}
<style jsx>{` <style jsx>{`
@ -43,3 +41,4 @@ export const Cell = ({ children }) =>
} }
`}</style> `}</style>
</td> </td>
)

View File

@ -2,7 +2,7 @@ import { graphql } from 'react-apollo'
import { Table, Head, Cell } from './table' import { Table, Head, Cell } from './table'
import uploadsQuery from '../queries/uploads' import uploadsQuery from '../queries/uploads'
const UploadList = ({ data: { uploads = [] } }) => const UploadList = ({ data: { uploads = [] } }) => (
<Table <Table
thead={ thead={
<tr> <tr>
@ -12,22 +12,15 @@ const UploadList = ({ data: { uploads = [] } }) =>
<Head>Path</Head> <Head>Path</Head>
</tr> </tr>
} }
tbody={uploads.map(({ id, name, type, size, path }) => tbody={uploads.map(({ id, name, type, size, path }) => (
<tr key={id}> <tr key={id}>
<Cell> <Cell>{name}</Cell>
{name} <Cell>{type}</Cell>
</Cell> <Cell>{size}</Cell>
<Cell> <Cell>{path}</Cell>
{type}
</Cell>
<Cell>
{size}
</Cell>
<Cell>
{path}
</Cell>
</tr> </tr>
)} ))}
/> />
)
export default graphql(uploadsQuery)(UploadList) export default graphql(uploadsQuery)(UploadList)

View File

@ -58,12 +58,11 @@ export default ComposedComponent =>
} }
// If the page component has initial props, merge them in. // If the page component has initial props, merge them in.
if (ComposedComponent.getInitialProps) { if (ComposedComponent.getInitialProps)
Object.assign( Object.assign(
initialProps.composedComponentProps, initialProps.composedComponentProps,
await ComposedComponent.getInitialProps(context) await ComposedComponent.getInitialProps(context)
) )
}
if (ssrMode) { if (ssrMode) {
const apolloClient = createApolloClient() const apolloClient = createApolloClient()
@ -101,10 +100,10 @@ export default ComposedComponent =>
constructor(props) { constructor(props) {
super(props) super(props)
if (ssrMode) { if (ssrMode)
// For the server an Apollo Client instance exists per request // For the server an Apollo Client instance exists per request
this.apolloClient = createApolloClient(this.props.initialState) this.apolloClient = createApolloClient(this.props.initialState)
} else { else {
// For the client an Apollo Client instance is shared between pages // For the client an Apollo Client instance is shared between pages
if (!apolloClient) if (!apolloClient)
apolloClient = createApolloClient(this.props.initialState) apolloClient = createApolloClient(this.props.initialState)

View File

@ -4,11 +4,12 @@ import MultipleUploader from '../components/multiple-uploader'
import UploadList from '../components/upload-list' import UploadList from '../components/upload-list'
import withData from '../helpers/with-data' import withData from '../helpers/with-data'
const HomePage = () => const HomePage = () => (
<Page title="Apollo upload examples"> <Page title="Apollo upload examples">
<SingleUploader /> <SingleUploader />
<MultipleUploader /> <MultipleUploader />
<UploadList /> <UploadList />
</Page> </Page>
)
export default withData(HomePage) export default withData(HomePage)