@@ -13,11 +13,20 @@ import Link from './PreloadLink';
13
13
import idx from 'idx' ;
14
14
import { NotificationContainer } from './Notifications' ;
15
15
import OneGraphLogo from './oneGraphLogo' ;
16
- import { Grommet , Grid , Box , Heading , Text , Anchor } from 'grommet' ;
16
+ import {
17
+ Grommet ,
18
+ Grid ,
19
+ Box ,
20
+ Heading ,
21
+ Text ,
22
+ Anchor ,
23
+ ResponsiveContext ,
24
+ } from 'grommet' ;
17
25
import { StatusCritical } from 'grommet-icons' ;
18
26
import ScrollMemory from 'react-router-scroll-memory' ;
19
27
import { matchPath } from 'react-router-dom' ;
20
28
import UserContext from './UserContext' ;
29
+ import NewsletterSignup from './NewsletterSignup' ;
21
30
22
31
import type { App_ViewerQueryResponse } from './__generated__/App_Query.graphql' ;
23
32
import type { Environment } from 'relay-runtime' ;
@@ -218,54 +227,75 @@ export default class App extends React.Component<
218
227
} } >
219
228
< NotificationContainer >
220
229
< Grommet theme = { theme } >
221
- < Grid
222
- fill
223
- rows = { [ 'auto' , 'flex' ] }
224
- columns = { [ 'flex' ] }
225
- areas = { [
226
- { name : 'header' , start : [ 0 , 0 ] , end : [ 1 , 0 ] } ,
227
- { name : 'main' , start : [ 0 , 1 ] , end : [ 1 , 1 ] } ,
228
- ] } >
229
- < Box
230
- gridArea = "header"
231
- direction = "row"
232
- align = "center"
233
- justify = "between"
234
- pad = { { horizontal : 'medium' , vertical : 'medium' } }
235
- wrap = { true } >
236
- < Box align = "center" direction = "row" >
237
- < OneGraphLogo width = "96px" height = "96px" /> { ' ' }
238
- < Heading level = { 2 } >
239
- < Link style = { { color : 'inherit' } } to = "/" >
240
- OneGraph Product Updates
241
- </ Link >
242
- </ Heading >
243
- </ Box >
244
- < Anchor href = "https://onegraph.com" >
245
- < Text size = "small" > Learn more about OneGraph</ Text >
246
- </ Anchor >
247
- </ Box >
248
- < Box gridArea = "main" >
249
- < ScrollMemory />
250
- < Switch >
251
- { routes . map ( ( routeConfig , i ) => (
252
- < Route
253
- key = { i }
254
- path = { routeConfig . path }
255
- exact = { routeConfig . exact }
256
- strict = { routeConfig . strict }
257
- render = { props => (
258
- < RenderRoute
259
- environment = { this . props . environment }
260
- match = { props . match }
261
- routeConfig = { routeConfig }
262
- />
263
- ) }
264
- />
265
- ) ) }
266
- </ Switch >
267
- </ Box >
268
- </ Grid >
230
+ < ResponsiveContext . Consumer >
231
+ { size => {
232
+ const small = size === 'small' ;
233
+ return (
234
+ < Grid
235
+ fill
236
+ rows = { [ 'auto' , 'flex' ] }
237
+ columns = { small ? [ 'flex' ] : [ 'flex' , 'auto' ] }
238
+ areas = {
239
+ small
240
+ ? [
241
+ { name : 'header' , start : [ 0 , 0 ] , end : [ 1 , 0 ] } ,
242
+ { name : 'main' , start : [ 0 , 1 ] , end : [ 1 , 1 ] } ,
243
+ ]
244
+ : [
245
+ { name : 'header' , start : [ 0 , 0 ] , end : [ 1 , 0 ] } ,
246
+ { name : 'main' , start : [ 0 , 1 ] , end : [ 1 , 1 ] } ,
247
+ { name : 'sidebar' , start : [ 1 , 1 ] , end : [ 1 , 1 ] } ,
248
+ ]
249
+ } >
250
+ < Box
251
+ gridArea = "header"
252
+ direction = "row"
253
+ align = "center"
254
+ justify = "between"
255
+ pad = { { horizontal : 'medium' , vertical : 'medium' } }
256
+ wrap = { true } >
257
+ < Box align = "center" direction = "row" >
258
+ < OneGraphLogo width = "96px" height = "96px" /> { ' ' }
259
+ < Heading level = { 2 } >
260
+ < Link style = { { color : 'inherit' } } to = "/" >
261
+ OneGraph Product Updates
262
+ </ Link >
263
+ </ Heading >
264
+ </ Box >
265
+ < Anchor href = "https://onegraph.com" >
266
+ < Text size = "small" > Learn more about OneGraph</ Text >
267
+ </ Anchor >
268
+ </ Box >
269
+ { small ||
270
+ ! process . env . RAZZLE_ENABLE_MAILCHIMP_SIGNUP ? null : (
271
+ < Box gridArea = "sidebar" pad = "medium" width = "medium" >
272
+ < NewsletterSignup />
273
+ </ Box >
274
+ ) }
275
+ < Box gridArea = "main" >
276
+ < ScrollMemory />
277
+ < Switch >
278
+ { routes . map ( ( routeConfig , i ) => (
279
+ < Route
280
+ key = { i }
281
+ path = { routeConfig . path }
282
+ exact = { routeConfig . exact }
283
+ strict = { routeConfig . strict }
284
+ render = { props => (
285
+ < RenderRoute
286
+ environment = { this . props . environment }
287
+ match = { props . match }
288
+ routeConfig = { routeConfig }
289
+ />
290
+ ) }
291
+ />
292
+ ) ) }
293
+ </ Switch >
294
+ </ Box >
295
+ </ Grid >
296
+ ) ;
297
+ } }
298
+ </ ResponsiveContext . Consumer >
269
299
</ Grommet >
270
300
</ NotificationContainer >
271
301
</ UserContext . Provider >
0 commit comments