Last active
October 20, 2018 22:02
-
-
Save ryanbelke/da63a9efedd0290ec21b2085d67384fc to your computer and use it in GitHub Desktop.
new _app.js with Apollo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* /pages/_app.js */ | |
| import Layout from "../components/Layout"; | |
| import withData from "../lib/apollo"; | |
| import App, { Container } from "next/app"; | |
| import React from "react"; | |
| class MyApp extends App { | |
| static async getInitialProps({ Component, router, ctx }) { | |
| let pageProps = {}; | |
| if (Component.getInitialProps) { | |
| pageProps = await Component.getInitialProps(ctx); | |
| } | |
| return { pageProps }; | |
| } | |
| render() { | |
| const { Component, pageProps, isAuthenticated, ctx } = this.props; | |
| return ( | |
| <Container> | |
| <Layout isAuthenticated={isAuthenticated} {...pageProps}> | |
| <Component {...pageProps} /> | |
| </Layout> | |
| <style jsx global> | |
| {` | |
| a { | |
| color: white !important; | |
| } | |
| a:link { | |
| text-decoration: none !important; | |
| color: white !important; | |
| } | |
| a:hover { | |
| color: white; | |
| } | |
| .card { | |
| display: inline-block !important; | |
| } | |
| .card-columns { | |
| column-count: 3; | |
| } | |
| `} | |
| </style> | |
| </Container> | |
| ); | |
| } | |
| } | |
| export default withData(MyApp); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment