-
Notifications
You must be signed in to change notification settings - Fork 1
/
_app.js
51 lines (44 loc) · 1.22 KB
/
_app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import React from "react";
import App, { Container } from "next/app";
import Head from "next/head";
import { ApolloProvider } from "react-apollo";
import { ThemeManager, LanguageManager, withApollo } from "../app-core";
const { AppTheme, ThemeProvider } = ThemeManager;
const { AppLanguage, LanguageProvider } = LanguageManager;
/**
* App
*/
class NewsApp extends App {
constructor(props) {
super(props);
this.toggleTheme = newTheme => {
this.setState({
theme: newTheme
});
};
// State also contains the updater function so it will
// be passed down into the context provider
this.state = {
theme: AppTheme,
toggleTheme: this.toggleTheme
};
}
render() {
const { Component, pageProps, apolloClient } = this.props;
return (
<LanguageProvider value={AppLanguage}>
<ThemeProvider value={this.state}>
<Container>
<ApolloProvider client={apolloClient}>
<Head>
<title>News Kit</title>
</Head>
<Component {...pageProps} />
</ApolloProvider>
</Container>
</ThemeProvider>
</LanguageProvider>
);
}
}
export default withApollo(NewsApp);