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

View File

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

View File

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

View File

@ -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 = [] } }) => (
<Table
thead={
<tr>
@ -12,22 +12,15 @@ const UploadList = ({ data: { uploads = [] } }) =>
<Head>Path</Head>
</tr>
}
tbody={uploads.map(({ id, name, type, size, path }) =>
tbody={uploads.map(({ id, name, type, size, path }) => (
<tr key={id}>
<Cell>
{name}
</Cell>
<Cell>
{type}
</Cell>
<Cell>
{size}
</Cell>
<Cell>
{path}
</Cell>
<Cell>{name}</Cell>
<Cell>{type}</Cell>
<Cell>{size}</Cell>
<Cell>{path}</Cell>
</tr>
)}
))}
/>
)
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 (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)

View File

@ -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 = () => (
<Page title="Apollo upload examples">
<SingleUploader />
<MultipleUploader />
<UploadList />
</Page>
)
export default withData(HomePage)