182 | { 183 | heroUrl && 184 |
212 | { 213 | author && 214 |
228 |
├── .eslintignore
├── __mocks__
├── styleMock.js
├── fileMock.js
├── pages.js
├── metadata.js
├── author.js
├── links.js
├── post.js
└── posts.js
├── .gitignore
├── static
├── favicon.ico
├── favicon-16x16.png
├── favicon-32x32.png
├── apple-touch-icon.png
├── mstile-150x150.png
├── android-chrome-192x192.png
├── android-chrome-512x512.png
├── manifest.json
└── safari-pinned-tab.svg
├── config.js
├── routes.js
├── now.json
├── assets
└── svg
│ ├── baseline-title-24px.svg
│ ├── facebook-f.svg
│ ├── twitter.svg
│ ├── reddit-alien.svg
│ └── hooli.svg
├── jest.setup.js
├── utils
├── handleBackBtnClick
│ └── index.js
├── constants.js
├── createCustomTheme
│ └── index.js
└── createTypography
│ └── index.js
├── .eslintrc.js
├── components
├── AuthorInfo
│ ├── AuthorInfo.test.jsx
│ ├── index.jsx
│ └── __snapshots__
│ │ └── AuthorInfo.test.jsx.snap
├── AppBar
│ ├── AppBar.test.jsx
│ ├── index.jsx
│ └── __snapshots__
│ │ └── AppBar.test.jsx.snap
├── AppContainer
│ └── index.jsx
├── PostPreview
│ ├── PostPreview.test.jsx
│ ├── index.jsx
│ └── __snapshots__
│ │ └── PostPreview.test.jsx.snap
├── AppearanceDialog
│ ├── AppearanceDialog.test.jsx
│ ├── index.jsx
│ └── __snapshots__
│ │ └── AppearanceDialog.test.jsx.snap
└── SocialLinks
│ ├── SocialLinks.test.jsx
│ └── index.jsx
├── pages
├── post
│ ├── post.test.jsx
│ └── index.jsx
├── index
│ ├── index.test.jsx
│ ├── index.jsx
│ └── __snapshots__
│ │ └── index.test.jsx.snap
├── _app.jsx
└── _document.jsx
├── jest.config.js
├── state
├── appearance
│ ├── actions.js
│ └── reducer.js
├── index.js
├── links
│ ├── reducer.js
│ └── actions.js
├── metadata
│ ├── reducer.js
│ └── actions.js
├── posts
│ ├── actions.js
│ └── reducer.js
└── pages
│ ├── reducer.js
│ └── actions.js
├── LICENSE
├── .babelrc
├── src
├── getPageContext.js
└── withRoot.jsx
├── lib
└── withReduxStore
│ └── index.jsx
├── README.md
├── package.json
└── server.js
/.eslintignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | .next/
3 |
--------------------------------------------------------------------------------
/__mocks__/styleMock.js:
--------------------------------------------------------------------------------
1 | module.exports = {};
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | .next/
3 |
4 | *.env*
5 |
--------------------------------------------------------------------------------
/__mocks__/fileMock.js:
--------------------------------------------------------------------------------
1 | module.exports = 'test-file-stub';
2 |
--------------------------------------------------------------------------------
/static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cosmicjs/cosmic-react-blog/master/static/favicon.ico
--------------------------------------------------------------------------------
/static/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cosmicjs/cosmic-react-blog/master/static/favicon-16x16.png
--------------------------------------------------------------------------------
/static/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cosmicjs/cosmic-react-blog/master/static/favicon-32x32.png
--------------------------------------------------------------------------------
/static/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cosmicjs/cosmic-react-blog/master/static/apple-touch-icon.png
--------------------------------------------------------------------------------
/static/mstile-150x150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cosmicjs/cosmic-react-blog/master/static/mstile-150x150.png
--------------------------------------------------------------------------------
/static/android-chrome-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cosmicjs/cosmic-react-blog/master/static/android-chrome-192x192.png
--------------------------------------------------------------------------------
/static/android-chrome-512x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cosmicjs/cosmic-react-blog/master/static/android-chrome-512x512.png
--------------------------------------------------------------------------------
/config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | API_URL: 'https://cosmicblog.chriso.io/api',
3 | BASE_URL: 'https://cosmicblog.chriso.io',
4 | };
5 |
--------------------------------------------------------------------------------
/routes.js:
--------------------------------------------------------------------------------
1 | const nextRoutes = require('next-routes');
2 |
3 | const routes = nextRoutes();
4 | routes.add('post', '/post/:slug');
5 |
6 | module.exports = routes;
7 |
--------------------------------------------------------------------------------
/now.json:
--------------------------------------------------------------------------------
1 | {
2 | "alias": [
3 | "cosmicblog.chriso.io",
4 | "www.cosmicblog.chriso.io"
5 | ],
6 | "dotenv": ".env.production",
7 | "public": false
8 | }
9 |
--------------------------------------------------------------------------------
/assets/svg/baseline-title-24px.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/assets/svg/facebook-f.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/__mocks__/pages.js:
--------------------------------------------------------------------------------
1 | export default {
2 | 1: {
3 | finishedLoadAt: 1526859679918,
4 | isLoading: false,
5 | startedLoadAt: 1526859679433,
6 | slugs: ['a-wonderful-blog-post-about-earth', 'another-wonderful-blog-post-about-earth'],
7 | },
8 | };
9 |
--------------------------------------------------------------------------------
/__mocks__/metadata.js:
--------------------------------------------------------------------------------
1 | export default {
2 | finishedLoadAt: 1526859679840,
3 | isLoading: false,
4 | logo: {
5 | url: 'url.png',
6 | imgix_url: 'ingix_url.png',
7 | },
8 | startedLoadAt: 1526859679433,
9 | tag: '"Content is king" -- Bill Gates',
10 | title: 'My Amazing Blog',
11 | };
12 |
--------------------------------------------------------------------------------
/jest.setup.js:
--------------------------------------------------------------------------------
1 | import { configure, mount, render, shallow } from 'enzyme';
2 | import Adapter from 'enzyme-adapter-react-16';
3 | import enzymeToJson from 'enzyme-to-json';
4 |
5 | global.mount = mount;
6 | global.render = render;
7 | global.shallow = shallow;
8 | global.toJson = enzymeToJson;
9 |
10 | configure({ adapter: new Adapter() });
11 |
--------------------------------------------------------------------------------
/utils/handleBackBtnClick/index.js:
--------------------------------------------------------------------------------
1 | import { Router } from '../../routes';
2 |
3 | const handleBackBtnClick = () => {
4 | // window.previouslyLoaded is set to true the first time App is loaded.
5 | // /pages/_app.jsx
6 | if (window.previouslyLoaded) {
7 | return Router.back();
8 | }
9 |
10 | return Router.pushRoute('/');
11 | };
12 |
13 | export default handleBackBtnClick;
14 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | browser: true,
4 | commonjs: true,
5 | },
6 | parser: 'babel-eslint',
7 | plugins: ['react', 'env'],
8 | extends: 'airbnb',
9 | rules: {
10 | 'import/no-extraneous-dependencies': ['off'],
11 | 'jsx-a11y/anchor-is-valid': ['off'],
12 | 'no-undef': ['off'],
13 | 'react/react-in-jsx-scope': ['off']
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/components/AuthorInfo/AuthorInfo.test.jsx:
--------------------------------------------------------------------------------
1 | import author from '../../__mocks__/author';
2 | import AuthorInfo from '.';
3 |
4 | describe('AuthorInfo', () => {
5 | it('should render', () => {
6 | const component = mount((
7 |
Something about John...
', 7 | metafields: [ 8 | { 9 | value: '9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 10 | key: 'image', 11 | title: 'Image', 12 | type: 'file', 13 | children: null, 14 | url: 'https://s3-us-west-2.amazonaws.com/cosmicjs/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 15 | imgix_url: 'https://cosmic-s3.imgix.net/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 16 | }, 17 | ], 18 | type_slug: 'authors', 19 | created: '2017-10-12T13:27:49.665Z', 20 | created_at: '2017-10-12T13:27:49.665Z', 21 | modified_at: '2018-05-17T17:44:12.977Z', 22 | status: 'published', 23 | published_at: '2018-05-17T17:44:12.977Z', 24 | metadata: { 25 | image: { 26 | url: 'https://s3-us-west-2.amazonaws.com/cosmicjs/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 27 | imgix_url: 'https://cosmic-s3.imgix.net/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 28 | }, 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Chris Overstreet 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /state/links/reducer.js: -------------------------------------------------------------------------------- 1 | import { actionTypes } from './actions'; 2 | 3 | const { 4 | CATCH_LINKS_FETCH_ERROR, 5 | RECEIVE_LINKS, 6 | REQUEST_LINKS, 7 | } = actionTypes; 8 | 9 | const defaultRootState = { 10 | error: undefined, 11 | finishedLoadAt: undefined, 12 | isLoading: false, 13 | items: undefined, 14 | startedLoadAt: undefined, 15 | }; 16 | 17 | const rootReducer = (state = defaultRootState, action) => { 18 | switch (action.type) { 19 | case CATCH_LINKS_FETCH_ERROR: 20 | return { 21 | ...state, 22 | error: action.error, 23 | finishedLoadAt: Date.now(), 24 | isLoading: false, 25 | }; 26 | case RECEIVE_LINKS: 27 | return { 28 | ...state, 29 | error: undefined, 30 | finishedLoadAt: Date.now(), 31 | isLoading: false, 32 | items: action.items, 33 | }; 34 | case REQUEST_LINKS: 35 | return { 36 | ...state, 37 | error: undefined, 38 | isLoading: true, 39 | startedLoadAt: Date.now(), 40 | }; 41 | default: 42 | return state; 43 | } 44 | }; 45 | 46 | export default rootReducer; 47 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "development": { 4 | "presets": [ 5 | [ 6 | "next/babel", 7 | { 8 | "styled-jsx": { 9 | "plugins": [ 10 | "styled-jsx-plugin-sass" 11 | ] 12 | } 13 | } 14 | ] 15 | ], 16 | "plugins": [ 17 | "inline-dotenv" 18 | ] 19 | }, 20 | "production": { 21 | "presets": [ 22 | [ 23 | "next/babel", 24 | { 25 | "styled-jsx": { 26 | "plugins": [ 27 | "styled-jsx-plugin-sass" 28 | ] 29 | } 30 | } 31 | ] 32 | ], 33 | "plugins": [ 34 | "transform-inline-environment-variables" 35 | ] 36 | }, 37 | "test": { 38 | "presets": [ 39 | [ 40 | "next/babel", 41 | { 42 | "preset-env": { 43 | "modules": "commonjs" 44 | }, 45 | "styled-jsx": { 46 | "plugins": [ 47 | "styled-jsx-plugin-sass" 48 | ] 49 | } 50 | } 51 | ] 52 | ] 53 | } 54 | }, 55 | "plugins": [ 56 | "inline-react-svg" 57 | ] 58 | } 59 | -------------------------------------------------------------------------------- /state/metadata/reducer.js: -------------------------------------------------------------------------------- 1 | import { actionTypes } from './actions'; 2 | 3 | const { 4 | CATCH_METADATA_FETCH_ERROR, 5 | RECEIVE_SITE_METADATA, 6 | REQUEST_SITE_METADATA, 7 | } = actionTypes; 8 | 9 | const defaultRootState = { 10 | error: undefined, 11 | finishedLoadAt: undefined, 12 | isLoading: false, 13 | logo: undefined, 14 | startedLoadAt: undefined, 15 | tag: undefined, 16 | title: undefined, 17 | }; 18 | 19 | const rootReducer = (state = defaultRootState, action) => { 20 | switch (action.type) { 21 | case CATCH_METADATA_FETCH_ERROR: 22 | return { 23 | ...state, 24 | error: action.error, 25 | finishedLoadAt: Date.now(), 26 | isLoading: false, 27 | }; 28 | case RECEIVE_SITE_METADATA: 29 | return { 30 | ...state, 31 | error: undefined, 32 | finishedLoadAt: Date.now(), 33 | isLoading: false, 34 | logo: action.logo, 35 | tag: action.tag, 36 | title: action.title, 37 | }; 38 | case REQUEST_SITE_METADATA: 39 | return { 40 | ...state, 41 | error: undefined, 42 | isLoading: true, 43 | startedLoadAt: Date.now(), 44 | }; 45 | default: 46 | return state; 47 | } 48 | }; 49 | 50 | export default rootReducer; 51 | -------------------------------------------------------------------------------- /__mocks__/links.js: -------------------------------------------------------------------------------- 1 | export default { 2 | finishedLoadAt: 1527021510298, 3 | isLoading: false, 4 | items: [ 5 | { 6 | content: 'Cosmic JS', 7 | icon: 'https://cosmic-s3.imgix.net/d6286310-5dcd-11e8-9db3-17fe5e4c3dd5-logo.png', 8 | slug: 'cosmic-js', 9 | url: 'https://cosmicjs.com/', 10 | }, 11 | { 12 | content: 'Facebook', 13 | icon: 'https://cosmic-s3.imgix.net/00170740-5df5-11e8-a1ae-3923d095aa54-facebook-f.svg', 14 | slug: 'facebook', 15 | url: 'https://www.facebook.com/neildegrassetyson/', 16 | }, 17 | { 18 | content: 'Twitter', 19 | icon: 'https://cosmic-s3.imgix.net/de154760-5df4-11e8-a1ae-3923d095aa54-twitter.svg', 20 | slug: 'twitter', 21 | url: 'https://twitter.com/SpaceX?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor', 22 | }, 23 | { 24 | content: 'NASA', 25 | icon: 'https://cosmic-s3.imgix.net/6071bc30-5df4-11e8-b874-7ddc7f75f297-nasa-vector.jpg', 26 | slug: 'nasa', 27 | url: 'https://www.nasa.gov/', 28 | }, 29 | { 30 | content: 'Hooli', 31 | icon: 'https://cosmic-s3.imgix.net/107f1f10-5df4-11e8-8b90-49cb251195d1-hooli.svg', 32 | slug: 'hooli', 33 | url: 'http://www.hooli.xyz/', 34 | }, 35 | 36 | ], 37 | startedLoadAt: 1527021509874, 38 | }; 39 | -------------------------------------------------------------------------------- /src/getPageContext.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-underscore-dangle */ 2 | /* source: https://github.com/mui-org/material-ui/blob/master/examples/nextjs/src/getPageContext.js */ 3 | import { SheetsRegistry } from 'jss'; 4 | import { createGenerateClassName } from '@material-ui/core/styles'; 5 | 6 | import createCustomTheme from '../utils/createCustomTheme'; 7 | 8 | // A theme with custom primary and secondary color. 9 | // It's optional. 10 | const theme = createCustomTheme({ 11 | htmlFontSize: 16, 12 | theme: 'light', 13 | }); 14 | 15 | function createPageContext() { 16 | return { 17 | theme, 18 | // This is needed in order to deduplicate the injection of CSS in the page. 19 | sheetsManager: new Map(), 20 | // This is needed in order to inject the critical CSS. 21 | sheetsRegistry: new SheetsRegistry(), 22 | // The standard class name generator. 23 | generateClassName: createGenerateClassName(), 24 | }; 25 | } 26 | 27 | export default function getPageContext() { 28 | // Make sure to create a new context for every server-side request so that data 29 | // isn't shared between connections (which would be bad). 30 | if (!process.browser) { 31 | return createPageContext(); 32 | } 33 | 34 | // Reuse context on the client-side. 35 | if (!global.__INIT_MATERIAL_UI__) { 36 | global.__INIT_MATERIAL_UI__ = createPageContext(); 37 | } 38 | 39 | return global.__INIT_MATERIAL_UI__; 40 | } 41 | -------------------------------------------------------------------------------- /assets/svg/hooli.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /state/posts/actions.js: -------------------------------------------------------------------------------- 1 | import fetch from 'isomorphic-unfetch'; 2 | import { API_URL } from '../../utils/constants'; 3 | 4 | const actionTypes = { 5 | CATCH_POST_FETCH_ERROR: 'CATCH_POST_FETCH_ERROR', 6 | RECEIVE_POST: 'RECEIVE_POST', 7 | REQUEST_POST: 'REQUEST_POST', 8 | }; 9 | 10 | const catchPostFetchError = (error, slug) => ({ 11 | type: actionTypes.CATCH_POST_FETCH_ERROR, 12 | error, 13 | slug, 14 | }); 15 | 16 | const receivePost = post => ({ 17 | type: actionTypes.RECEIVE_POST, 18 | post, 19 | slug: post && post.slug, 20 | }); 21 | 22 | const requestPost = slug => ({ 23 | type: actionTypes.REQUEST_POST, 24 | slug, 25 | }); 26 | 27 | const fetchPost = slug => (dispatch) => { 28 | dispatch(requestPost(slug)); 29 | 30 | return fetch(`${API_URL}/post/${slug}`) 31 | .then(res => res.json()) 32 | .then(json => dispatch(receivePost(json.object))) 33 | .catch(err => dispatch(catchPostFetchError(err, slug))); 34 | }; 35 | 36 | const shouldFetchPost = (slug, state) => { 37 | const { posts } = state; 38 | 39 | if (!posts[slug]) return true; 40 | if (posts[slug].isLoading) return false; 41 | return !posts[slug].post; 42 | }; 43 | 44 | const fetchPostIfNeeded = slug => (dispatch, getState) => { 45 | if (shouldFetchPost(slug, getState())) return dispatch(fetchPost(slug)); 46 | return Promise.resolve(); 47 | }; 48 | 49 | export { 50 | actionTypes, 51 | catchPostFetchError, 52 | fetchPost, 53 | fetchPostIfNeeded, 54 | receivePost, 55 | requestPost, 56 | shouldFetchPost, 57 | }; 58 | -------------------------------------------------------------------------------- /state/pages/reducer.js: -------------------------------------------------------------------------------- 1 | import { actionTypes } from './actions'; 2 | 3 | const { 4 | CATCH_PAGE_FETCH_ERROR, 5 | RECEIVE_PAGE, 6 | REQUEST_PAGE, 7 | } = actionTypes; 8 | 9 | const defaultPageState = { 10 | error: undefined, 11 | finishedLoadAt: undefined, 12 | isLoading: false, 13 | startedLoadAt: undefined, 14 | slugs: undefined, 15 | }; 16 | 17 | const page = (state = defaultPageState, action) => { 18 | switch (action.type) { 19 | case CATCH_PAGE_FETCH_ERROR: 20 | return { 21 | ...state, 22 | error: action.error, 23 | finishedLoadAt: Date.now(), 24 | isLoading: false, 25 | }; 26 | case RECEIVE_PAGE: 27 | return { 28 | ...state, 29 | error: undefined, 30 | finishedLoadAt: Date.now(), 31 | isLoading: false, 32 | slugs: action.slugs, 33 | }; 34 | case REQUEST_PAGE: 35 | return { 36 | ...state, 37 | error: undefined, 38 | isLoading: true, 39 | startedLoadAt: Date.now(), 40 | }; 41 | default: 42 | return state; 43 | } 44 | }; 45 | 46 | const defaultRootState = {}; 47 | 48 | const rootReducer = (state = defaultRootState, action) => { 49 | switch (action.type) { 50 | case CATCH_PAGE_FETCH_ERROR: 51 | case RECEIVE_PAGE: 52 | case REQUEST_PAGE: 53 | return { 54 | ...state, 55 | [action.page]: page(state[action.page], action), 56 | }; 57 | default: 58 | return state; 59 | } 60 | }; 61 | 62 | export default rootReducer; 63 | -------------------------------------------------------------------------------- /state/posts/reducer.js: -------------------------------------------------------------------------------- 1 | import { actionTypes } from './actions'; 2 | 3 | const { 4 | CATCH_POST_FETCH_ERROR, 5 | RECEIVE_POST, 6 | REQUEST_POST, 7 | } = actionTypes; 8 | 9 | const defaultPostState = { 10 | error: undefined, 11 | finishedLoadAt: undefined, 12 | isLoading: false, 13 | startedLoadAt: undefined, 14 | post: undefined, 15 | }; 16 | 17 | const post = (state = defaultPostState, action) => { 18 | switch (action.type) { 19 | case CATCH_POST_FETCH_ERROR: 20 | return { 21 | ...state, 22 | error: action.error, 23 | finishedLoadAt: Date.now(), 24 | isLoading: false, 25 | }; 26 | case RECEIVE_POST: 27 | return { 28 | ...state, 29 | error: undefined, 30 | finishedLoadAt: Date.now(), 31 | isLoading: false, 32 | post: action.post, 33 | }; 34 | case REQUEST_POST: 35 | return { 36 | ...state, 37 | error: undefined, 38 | isLoading: true, 39 | startedLoadAt: Date.now(), 40 | }; 41 | default: 42 | return state; 43 | } 44 | }; 45 | 46 | const defaultRootState = {}; 47 | 48 | const rootReducer = (state = defaultRootState, action) => { 49 | switch (action.type) { 50 | case CATCH_POST_FETCH_ERROR: 51 | case RECEIVE_POST: 52 | case REQUEST_POST: 53 | return { 54 | ...state, 55 | [action.slug]: post(state[action.slug], action), 56 | }; 57 | default: 58 | return state; 59 | } 60 | }; 61 | 62 | export default rootReducer; 63 | -------------------------------------------------------------------------------- /lib/withReduxStore/index.jsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-underscore-dangle */ 2 | import React, { Component } from 'react'; 3 | import PropTypes from 'prop-types'; 4 | 5 | import initializeStore from '../../state'; 6 | 7 | const isServer = typeof window === 'undefined'; 8 | const __NEXT_REDUX_STORE__ = '__NEXT_REDUX_STORE__'; 9 | 10 | const getOrCreateStore = (initialState) => { 11 | if (isServer) { 12 | return initializeStore(initialState); 13 | } 14 | 15 | if (!window[__NEXT_REDUX_STORE__]) { 16 | window[__NEXT_REDUX_STORE__] = initializeStore(initialState); 17 | } 18 | 19 | return window[__NEXT_REDUX_STORE__]; 20 | }; 21 | 22 | const withStore = App => class Redux extends Component { 23 | static async getInitialProps(appContext) { 24 | const reduxStore = getOrCreateStore(); 25 | 26 | appContext.ctx.reduxStore = reduxStore; // eslint-disable-line no-param-reassign 27 | 28 | let appProps = {}; 29 | if (App.getInitialProps) { 30 | appProps = await App.getInitialProps(appContext); 31 | } 32 | 33 | return { 34 | ...appProps, 35 | initialReduxState: reduxStore.getState(), 36 | }; 37 | } 38 | 39 | static defaultProps = { 40 | initialReduxState: {}, 41 | }; 42 | 43 | static propTypes = { 44 | initialReduxState: PropTypes.shape({}), 45 | }; 46 | 47 | constructor(props) { 48 | super(props); 49 | this.reduxStore = getOrCreateStore(props.initialReduxState); 50 | } 51 | 52 | render() { 53 | return
91 | When I orbited the Earth in a spaceship, I saw for the first time how beautiful our planet is. Mankind, let us preserve and increase this beauty, and not destroy it!
Space, the final frontier. These are the voyages of the Starship Enterprise. Its five-year mission: to explore strange new worlds, to seek out new life and new civilizations, to boldly go where no man has gone before.
If you could see the earth illuminated when you were in a place as dark as night, it would look to you more splendid than the moon.
To be the first to enter the cosmos, to engage, single-handed, in an unprecedented duel with nature—could one dream of anything more?
We choose to go to the moon in this decade and do the other things, not because they are easy, but because they are hard, because that goal will serve to organize and measure the best of our energies and skills, because that challenge is one that we are willing to accept, one we are unwilling to postpone, and one which we intend to win.
NASA is not about the ‘Adventure of Human Space Exploration’…We won’t be doing it just to get out there in space – we’ll be doing it because the things we learn out there will be making life better for a lot of people who won’t be able to go.
Problems look mighty small from 150 miles up.
That's one small step for [a] man, one giant leap for mankind.
Where ignorance lurks, so too do the frontiers of discovery and imagination.
Dinosaurs are extinct today because they lacked opposable thumbs and the brainpower to build a space program.
', 7 | metafields: [ 8 | { 9 | value: '56363630-af74-11e7-b864-313f959a776e-react-blog.jpg', 10 | key: 'hero', 11 | title: 'Hero', 12 | type: 'file', 13 | children: null, 14 | url: 'https://s3-us-west-2.amazonaws.com/cosmicjs/56363630-af74-11e7-b864-313f959a776e-react-blog.jpg', 15 | imgix_url: 'https://cosmic-s3.imgix.net/56363630-af74-11e7-b864-313f959a776e-react-blog.jpg', 16 | }, { 17 | value: 'I don't know what you could say about a day in which you have seen four beautiful sunsets.
It suddenly struck me that that tiny pea, pretty and blue, was the Earth. I put up my thumb and shut one eye, and my thumb blotted out the planet Earth. I didn't feel like a giant. I felt very, very small....
', 18 | key: 'teaser', 19 | title: 'Teaser', 20 | type: 'html-textarea', 21 | children: null, 22 | }, { 23 | object_type: 'authors', 24 | value: '5afdbf6c44d74b4e924f1d09', 25 | key: 'author', 26 | title: 'Author', 27 | type: 'object', 28 | children: null, 29 | object: { 30 | _id: '5afdbf6c44d74b4e924f1d09', 31 | bucket: '5afdbcd115bef94f7421eb0d', 32 | slug: 'john-doe', 33 | title: 'John Doe', 34 | content: 'Something about John...
', 35 | metafields: [ 36 | { 37 | value: '9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 38 | key: 'image', 39 | title: 'Image', 40 | type: 'file', 41 | children: null, 42 | url: 'https://s3-us-west-2.amazonaws.com/cosmicjs/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 43 | imgix_url: 'https://cosmic-s3.imgix.net/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 44 | }, 45 | ], 46 | type_slug: 'authors', 47 | created: '2017-10-12T13:27:49.665Z', 48 | created_at: '2017-10-12T13:27:49.665Z', 49 | modified_at: '2018-05-17T17:44:12.977Z', 50 | status: 'published', 51 | published_at: '2018-05-17T17:44:12.977Z', 52 | metadata: { 53 | image: { 54 | url: 'https://s3-us-west-2.amazonaws.com/cosmicjs/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 55 | imgix_url: 'https://cosmic-s3.imgix.net/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 56 | }, 57 | }, 58 | }, 59 | }, 60 | ], 61 | type_slug: 'posts', 62 | created: '2017-10-12T13:27:49.665Z', 63 | created_at: '2017-10-12T13:27:49.665Z', 64 | modified_at: '2017-10-12T17:39:54.476Z', 65 | status: 'published', 66 | published_at: '2018-05-17T17:44:12.979Z', 67 | metadata: { 68 | hero: { 69 | url: 'https://s3-us-west-2.amazonaws.com/cosmicjs/56363630-af74-11e7-b864-313f959a776e-react-blog.jpg', 70 | imgix_url: 'https://cosmic-s3.imgix.net/56363630-af74-11e7-b864-313f959a776e-react-blog.jpg', 71 | }, 72 | teaser: 'I don't know what you could say about a day in which you have seen four beautiful sunsets.
It suddenly struck me that that tiny pea, pretty and blue, was the Earth. I put up my thumb and shut one eye, and my thumb blotted out the planet Earth. I didn't feel like a giant. I felt very, very small....
', 73 | author: { 74 | _id: '5afdbf6c44d74b4e924f1d09', 75 | bucket: '5afdbcd115bef94f7421eb0d', 76 | slug: 'john-doe', 77 | title: 'John Doe', 78 | content: 'Something about John...
', 79 | metafields: [ 80 | { 81 | value: '9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 82 | key: 'image', 83 | title: 'Image', 84 | type: 'file', 85 | children: null, 86 | url: 'https://s3-us-west-2.amazonaws.com/cosmicjs/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 87 | imgix_url: 'https://cosmic-s3.imgix.net/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 88 | }, 89 | ], 90 | type_slug: 'authors', 91 | created: '2017-10-12T13:27:49.665Z', 92 | created_at: '2017-10-12T13:27:49.665Z', 93 | modified_at: '2018-05-17T17:44:12.977Z', 94 | status: 'published', 95 | published_at: '2018-05-17T17:44:12.977Z', 96 | metadata: { 97 | image: { 98 | url: 'https://s3-us-west-2.amazonaws.com/cosmicjs/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 99 | imgix_url: 'https://cosmic-s3.imgix.net/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 100 | }, 101 | }, 102 | }, 103 | }, 104 | }; 105 | -------------------------------------------------------------------------------- /pages/index/index.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import { connect } from 'react-redux'; 4 | import { withStyles } from '@material-ui/core/styles'; 5 | import { compose } from 'recompose'; 6 | import Head from 'next/head'; 7 | 8 | import Typography from '@material-ui/core/Typography'; 9 | 10 | import withRoot from '../../src/withRoot'; 11 | import { fetchLinksIfNeeded } from '../../state/links/actions'; 12 | import { fetchSiteMetadataIfNeeded } from '../../state/metadata/actions'; 13 | import { fetchPageIfNeeded } from '../../state/pages/actions'; 14 | import PostPreview from '../../components/PostPreview'; 15 | import SocialLinks from '../../components/SocialLinks'; 16 | 17 | const styles = theme => ({ 18 | divider: { 19 | border: 0, 20 | borderTop: `1px solid ${theme.palette.text.secondary}`, 21 | height: 0, 22 | marginBottom: theme.spacing.unit * 6, 23 | maxWidth: 700, 24 | opacity: 0.2, 25 | width: '100%', 26 | }, 27 | root: { 28 | ...theme.mixins.gutters(), 29 | paddingTop: theme.spacing.unit * 6, 30 | paddingBottom: theme.spacing.unit * 6, 31 | }, 32 | logo: { 33 | display: 'block', 34 | margin: '0 auto', 35 | maxinWidth: 700, 36 | overflow: 'hidden', 37 | paddingTop: theme.spacing.unit * 6, 38 | paddingBottom: theme.spacing.unit * 6, 39 | }, 40 | postPreviews: { 41 | listStyle: 'none', 42 | marginBottom: theme.spacing.unit * 4, 43 | marginTop: theme.spacing.unit * 4, 44 | padding: 0, 45 | }, 46 | postPreviewsHeaderContainer: { 47 | marginTop: theme.spacing.unit * 4, 48 | padding: 0, 49 | }, 50 | postPreviewsHeader: { 51 | margin: '0 auto', 52 | maxWidth: 700, 53 | position: 'relative', 54 | }, 55 | postPreviewsHeaderTitle: { 56 | bottom: -1, 57 | borderBottom: `1px solid ${theme.palette.text.secondary}`, 58 | display: 'inline-block', 59 | padding: theme.spacing.unit, 60 | position: 'absolute', 61 | left: 0, 62 | }, 63 | postPreviewsHeaderContainerDivider: { 64 | border: 0, 65 | borderTop: `1px solid ${theme.palette.text.secondary}`, 66 | disaplay: 'block', 67 | height: 0, 68 | margin: '0 auto', 69 | maxWidth: 700, 70 | opacity: 0.2, 71 | padding: 0, 72 | width: '100%', 73 | }, 74 | tag: { 75 | display: 'block', 76 | textAlign: 'center', 77 | }, 78 | title: { 79 | display: 'block', 80 | textAlign: 'center', 81 | }, 82 | }); 83 | 84 | const Index = ({ 85 | classes, 86 | metadata, 87 | page, 88 | pages, 89 | posts, 90 | }) => { 91 | let postPreviews; 92 | try { 93 | postPreviews = pages[page].slugs.map(slug => posts[slug]); 94 | } catch (e) { 95 | postPreviews = undefined; 96 | } 97 | 98 | return ( 99 |When I orbited the Earth in a spaceship, I saw for the first time how beautiful our planet is. Mankind, let us preserve and increase this beauty, and not destroy it!
Space, the final frontier. These are the voyages of the Starship Enterprise. Its five-year mission: to explore strange new worlds, to seek out new life and new civilizations, to boldly go where no man has gone before.
If you could see the earth illuminated when you were in a place as dark as night, it would look to you more splendid than the moon.
To be the first to enter the cosmos, to engage, single-handed, in an unprecedented duel with nature—could one dream of anything more?
We choose to go to the moon in this decade and do the other things, not because they are easy, but because they are hard, because that goal will serve to organize and measure the best of our energies and skills, because that challenge is one that we are willing to accept, one we are unwilling to postpone, and one which we intend to win.
NASA is not about the ‘Adventure of Human Space Exploration’…We won’t be doing it just to get out there in space – we’ll be doing it because the things we learn out there will be making life better for a lot of people who won’t be able to go.
Problems look mighty small from 150 miles up.
That's one small step for [a] man, one giant leap for mankind.
Where ignorance lurks, so too do the frontiers of discovery and imagination.
Dinosaurs are extinct today because they lacked opposable thumbs and the brainpower to build a space program.
', 9 | metafields: [ 10 | { 11 | value: '56363630-af74-11e7-b864-313f959a776e-react-blog.jpg', 12 | key: 'hero', 13 | title: 'Hero', 14 | type: 'file', 15 | children: null, 16 | url: 'https://s3-us-west-2.amazonaws.com/cosmicjs/56363630-af74-11e7-b864-313f959a776e-react-blog.jpg', 17 | imgix_url: 'https://cosmic-s3.imgix.net/56363630-af74-11e7-b864-313f959a776e-react-blog.jpg', 18 | }, { 19 | value: 'I don't know what you could say about a day in which you have seen four beautiful sunsets.
It suddenly struck me that that tiny pea, pretty and blue, was the Earth. I put up my thumb and shut one eye, and my thumb blotted out the planet Earth. I didn't feel like a giant. I felt very, very small....
', 20 | key: 'teaser', 21 | title: 'Teaser', 22 | type: 'html-textarea', 23 | children: null, 24 | }, { 25 | object_type: 'authors', 26 | value: '5afdbf6c44d74b4e924f1d09', 27 | key: 'author', 28 | title: 'Author', 29 | type: 'object', 30 | children: null, 31 | object: { 32 | _id: '5afdbf6c44d74b4e924f1d09', 33 | bucket: '5afdbcd115bef94f7421eb0d', 34 | slug: 'john-doe', 35 | title: 'John Doe', 36 | content: 'Something about John...
', 37 | metafields: [ 38 | { 39 | value: '9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 40 | key: 'image', 41 | title: 'Image', 42 | type: 'file', 43 | children: null, 44 | url: 'https://s3-us-west-2.amazonaws.com/cosmicjs/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 45 | imgix_url: 'https://cosmic-s3.imgix.net/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 46 | }, 47 | ], 48 | type_slug: 'authors', 49 | created: '2017-10-12T13:27:49.665Z', 50 | created_at: '2017-10-12T13:27:49.665Z', 51 | modified_at: '2018-05-17T17:44:12.977Z', 52 | status: 'published', 53 | published_at: '2018-05-17T17:44:12.977Z', 54 | metadata: { 55 | image: { 56 | url: 'https://s3-us-west-2.amazonaws.com/cosmicjs/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 57 | imgix_url: 'https://cosmic-s3.imgix.net/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 58 | }, 59 | }, 60 | }, 61 | }, 62 | ], 63 | type_slug: 'posts', 64 | created: '2017-10-12T13:27:49.665Z', 65 | created_at: '2017-10-12T13:27:49.665Z', 66 | modified_at: '2017-10-12T17:39:54.476Z', 67 | status: 'published', 68 | published_at: '2018-05-17T17:44:12.979Z', 69 | metadata: { 70 | hero: { 71 | url: 'https://s3-us-west-2.amazonaws.com/cosmicjs/56363630-af74-11e7-b864-313f959a776e-react-blog.jpg', 72 | imgix_url: 'https://cosmic-s3.imgix.net/56363630-af74-11e7-b864-313f959a776e-react-blog.jpg', 73 | }, 74 | teaser: 'I don't know what you could say about a day in which you have seen four beautiful sunsets.
It suddenly struck me that that tiny pea, pretty and blue, was the Earth. I put up my thumb and shut one eye, and my thumb blotted out the planet Earth. I didn't feel like a giant. I felt very, very small....
', 75 | author: { 76 | _id: '5afdbf6c44d74b4e924f1d09', 77 | bucket: '5afdbcd115bef94f7421eb0d', 78 | slug: 'john-doe', 79 | title: 'John Doe', 80 | content: 'Something about John...
', 81 | metafields: [ 82 | { 83 | value: '9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 84 | key: 'image', 85 | title: 'Image', 86 | type: 'file', 87 | children: null, 88 | url: 'https://s3-us-west-2.amazonaws.com/cosmicjs/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 89 | imgix_url: 'https://cosmic-s3.imgix.net/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 90 | }, 91 | ], 92 | type_slug: 'authors', 93 | created: '2017-10-12T13:27:49.665Z', 94 | created_at: '2017-10-12T13:27:49.665Z', 95 | modified_at: '2018-05-17T17:44:12.977Z', 96 | status: 'published', 97 | published_at: '2018-05-17T17:44:12.977Z', 98 | metadata: { 99 | image: { 100 | url: 'https://s3-us-west-2.amazonaws.com/cosmicjs/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 101 | imgix_url: 'https://cosmic-s3.imgix.net/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg', 102 | }, 103 | }, 104 | }, 105 | }, 106 | }, 107 | }, 108 | 'another-wonderful-blog-post-about-earth': { 109 | post: { 110 | _id: '5afdbf6c44d74b4e924f1d0d', 111 | bucket: '5afdbcd115bef94f7421eb0d', 112 | slug: 'another-wonderful-blog-post-about-earth', 113 | title: 'Another Wonderful Blog Post About Earth', 114 | content: 'That's one small step for [a] man, one giant leap for mankind.
To be the first to enter the cosmos, to engage, single-handed, in an unprecedented duel with nature—could one dream of anything more?
The dreams of yesterday are the hopes of today and the reality of tomorrow.
The sky is the limit only for those who aren't afraid to fly!
Problems look mighty small from 150 miles up.
There can be no thought of finishing for ‘aiming for the stars.’ Both figuratively and literally, it is a task to occupy the generations. And no matter how much progress one makes, there is always the thrill of just beginning.
There can be no thought of finishing for ‘aiming for the stars.’ Both figuratively and literally, it is a task to occupy the generations. And no matter how much progress one makes, there is always the thrill of just beginning.
There can be no thought of finishing for ‘aiming for the stars.’ Both figuratively and literally, it is a task to occupy the generations. And no matter how much progress one makes, there is always the thrill of just beginning.
Houston, Tranquillity Base here. The Eagle has landed.
You know, being a test pilot isn't always the healthiest business in the world.
', 115 | metafields: [ 116 | { 117 | value: '99fd6650-23f5-11e7-875c-3f5dc9c15c2b-beach.jpg', 118 | key: 'hero', 119 | title: 'Hero', 120 | type: 'file', 121 | children: null, 122 | url: 'https://s3-us-west-2.amazonaws.com/cosmicjs/99fd6650-23f5-11e7-875c-3f5dc9c15c2b-beach.jpg', 123 | imgix_url: 'https://cosmic-s3.imgix.net/99fd6650-23f5-11e7-875c-3f5dc9c15c2b-beach.jpg', 124 | }, { 125 | value: 'Science cuts two ways, of course; its products can be used for both good and evil. But there's no turning back from science. The early warnings about technological dangers also come from science.
Houston, Tranquillity Base here. The Eagle has landed...
', 126 | key: 'teaser', 127 | title: 'Teaser', 128 | type: 'html-textarea', 129 | children: null, 130 | }, { 131 | object_type: 'authors', 132 | value: '5afdbf6c44d74b4e924f1d06', 133 | key: 'author', 134 | title: 'Author', 135 | type: 'object', 136 | children: null, 137 | object: { 138 | _id: '5afdbf6c44d74b4e924f1d06', 139 | bucket: '5afdbcd115bef94f7421eb0d', 140 | slug: 'jane-doe', 141 | title: 'Jane Doe', 142 | content: 'Something about Jane...
', 143 | metafields: [ 144 | { 145 | value: '99f48cb0-23f5-11e7-875c-3f5dc9c15c2b-female.jpg', 146 | key: 'image', 147 | title: 'Image', 148 | type: 'file', 149 | children: null, 150 | url: 'https://s3-us-west-2.amazonaws.com/cosmicjs/99f48cb0-23f5-11e7-875c-3f5dc9c15c2b-female.jpg', 151 | imgix_url: 'https://cosmic-s3.imgix.net/99f48cb0-23f5-11e7-875c-3f5dc9c15c2b-female.jpg', 152 | }, 153 | ], 154 | type_slug: 'authors', 155 | created: '2017-10-12T13:27:49.663Z', 156 | created_at: '2017-10-12T13:27:49.663Z', 157 | modified_at: '2018-05-17T17:44:12.973Z', 158 | status: 'published', 159 | published_at: '2018-05-17T17:44:12.973Z', 160 | metadata: { 161 | image: { 162 | url: 'https://s3-us-west-2.amazonaws.com/cosmicjs/99f48cb0-23f5-11e7-875c-3f5dc9c15c2b-female.jpg', 163 | imgix_url: 'https://cosmic-s3.imgix.net/99f48cb0-23f5-11e7-875c-3f5dc9c15c2b-female.jpg', 164 | }, 165 | }, 166 | }, 167 | }, { 168 | object_type: 'categories', 169 | value: '58f565290687f7353b0009bb,58f565210687f7353b0009ba', 170 | key: 'categories', 171 | title: 'Categories', 172 | type: 'objects', 173 | children: null, 174 | objects: [null, null], 175 | }, 176 | ], 177 | type_slug: 'posts', 178 | created: '2017-10-12T13:27:49.666Z', 179 | created_at: '2017-10-12T13:27:49.666Z', 180 | modified_at: '2018-05-17T17:44:12.981Z', 181 | status: 'published', 182 | published_at: '2018-05-17T17:44:12.981Z', 183 | metadata: { 184 | hero: { 185 | url: 'https://s3-us-west-2.amazonaws.com/cosmicjs/99fd6650-23f5-11e7-875c-3f5dc9c15c2b-beach.jpg', 186 | imgix_url: 'https://cosmic-s3.imgix.net/99fd6650-23f5-11e7-875c-3f5dc9c15c2b-beach.jpg', 187 | }, 188 | teaser: 'Science cuts two ways, of course; its products can be used for both good and evil. But there's no turning back from science. The early warnings about technological dangers also come from science.
Houston, Tranquillity Base here. The Eagle has landed...
', 189 | author: { 190 | _id: '5afdbf6c44d74b4e924f1d06', 191 | bucket: '5afdbcd115bef94f7421eb0d', 192 | slug: 'jane-doe', 193 | title: 'Jane Doe', 194 | content: 'Something about Jane...
', 195 | metafields: [ 196 | { 197 | value: '99f48cb0-23f5-11e7-875c-3f5dc9c15c2b-female.jpg', 198 | key: 'image', 199 | title: 'Image', 200 | type: 'file', 201 | children: null, 202 | url: 'https://s3-us-west-2.amazonaws.com/cosmicjs/99f48cb0-23f5-11e7-875c-3f5dc9c15c2b-female.jpg', 203 | imgix_url: 'https://cosmic-s3.imgix.net/99f48cb0-23f5-11e7-875c-3f5dc9c15c2b-female.jpg', 204 | }, 205 | ], 206 | type_slug: 'authors', 207 | created: '2017-10-12T13:27:49.663Z', 208 | created_at: '2017-10-12T13:27:49.663Z', 209 | modified_at: '2018-05-17T17:44:12.973Z', 210 | status: 'published', 211 | published_at: '2018-05-17T17:44:12.973Z', 212 | metadata: { 213 | image: { 214 | url: 'https://s3-us-west-2.amazonaws.com/cosmicjs/99f48cb0-23f5-11e7-875c-3f5dc9c15c2b-female.jpg', 215 | imgix_url: 'https://cosmic-s3.imgix.net/99f48cb0-23f5-11e7-875c-3f5dc9c15c2b-female.jpg', 216 | }, 217 | }, 218 | }, 219 | categories: [null, null], 220 | }, 221 | }, 222 | }, 223 | }; 224 | -------------------------------------------------------------------------------- /pages/index/__snapshots__/index.test.jsx.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Disconnected Index Page should render 1`] = ` 4 |Space, the final frontier. These are the voyages of the Starship Enterprise. Its five-year mission: to explore strange new worlds, to seek out new life and new civilizations, to boldly go where no man has gone before.
If you could see the earth illuminated when you were in a place as dark as night, it would look to you more splendid than the moon.
To be the first to enter the cosmos, to engage, single-handed, in an unprecedented duel with nature—could one dream of anything more?
We choose to go to the moon in this decade and do the other things, not because they are easy, but because they are hard, because that goal will serve to organize and measure the best of our energies and skills, because that challenge is one that we are willing to accept, one we are unwilling to postpone, and one which we intend to win.
NASA is not about the ‘Adventure of Human Space Exploration’…We won’t be doing it just to get out there in space – we’ll be doing it because the things we learn out there will be making life better for a lot of people who won’t be able to go.
Problems look mighty small from 150 miles up.
That's one small step for [a] man, one giant leap for mankind.
Where ignorance lurks, so too do the frontiers of discovery and imagination.
Dinosaurs are extinct today because they lacked opposable thumbs and the brainpower to build a space program.
", 53 | "created": "2017-10-12T13:27:49.665Z", 54 | "created_at": "2017-10-12T13:27:49.665Z", 55 | "metadata": Object { 56 | "author": Object { 57 | "_id": "5afdbf6c44d74b4e924f1d09", 58 | "bucket": "5afdbcd115bef94f7421eb0d", 59 | "content": "Something about John...
", 60 | "created": "2017-10-12T13:27:49.665Z", 61 | "created_at": "2017-10-12T13:27:49.665Z", 62 | "metadata": Object { 63 | "image": Object { 64 | "imgix_url": "https://cosmic-s3.imgix.net/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg", 65 | "url": "https://s3-us-west-2.amazonaws.com/cosmicjs/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg", 66 | }, 67 | }, 68 | "metafields": Array [ 69 | Object { 70 | "children": null, 71 | "imgix_url": "https://cosmic-s3.imgix.net/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg", 72 | "key": "image", 73 | "title": "Image", 74 | "type": "file", 75 | "url": "https://s3-us-west-2.amazonaws.com/cosmicjs/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg", 76 | "value": "9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg", 77 | }, 78 | ], 79 | "modified_at": "2018-05-17T17:44:12.977Z", 80 | "published_at": "2018-05-17T17:44:12.977Z", 81 | "slug": "john-doe", 82 | "status": "published", 83 | "title": "John Doe", 84 | "type_slug": "authors", 85 | }, 86 | "hero": Object { 87 | "imgix_url": "https://cosmic-s3.imgix.net/56363630-af74-11e7-b864-313f959a776e-react-blog.jpg", 88 | "url": "https://s3-us-west-2.amazonaws.com/cosmicjs/56363630-af74-11e7-b864-313f959a776e-react-blog.jpg", 89 | }, 90 | "teaser": "I don't know what you could say about a day in which you have seen four beautiful sunsets.
It suddenly struck me that that tiny pea, pretty and blue, was the Earth. I put up my thumb and shut one eye, and my thumb blotted out the planet Earth. I didn't feel like a giant. I felt very, very small....
", 91 | }, 92 | "metafields": Array [ 93 | Object { 94 | "children": null, 95 | "imgix_url": "https://cosmic-s3.imgix.net/56363630-af74-11e7-b864-313f959a776e-react-blog.jpg", 96 | "key": "hero", 97 | "title": "Hero", 98 | "type": "file", 99 | "url": "https://s3-us-west-2.amazonaws.com/cosmicjs/56363630-af74-11e7-b864-313f959a776e-react-blog.jpg", 100 | "value": "56363630-af74-11e7-b864-313f959a776e-react-blog.jpg", 101 | }, 102 | Object { 103 | "children": null, 104 | "key": "teaser", 105 | "title": "Teaser", 106 | "type": "html-textarea", 107 | "value": "I don't know what you could say about a day in which you have seen four beautiful sunsets.
It suddenly struck me that that tiny pea, pretty and blue, was the Earth. I put up my thumb and shut one eye, and my thumb blotted out the planet Earth. I didn't feel like a giant. I felt very, very small....
", 108 | }, 109 | Object { 110 | "children": null, 111 | "key": "author", 112 | "object": Object { 113 | "_id": "5afdbf6c44d74b4e924f1d09", 114 | "bucket": "5afdbcd115bef94f7421eb0d", 115 | "content": "Something about John...
", 116 | "created": "2017-10-12T13:27:49.665Z", 117 | "created_at": "2017-10-12T13:27:49.665Z", 118 | "metadata": Object { 119 | "image": Object { 120 | "imgix_url": "https://cosmic-s3.imgix.net/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg", 121 | "url": "https://s3-us-west-2.amazonaws.com/cosmicjs/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg", 122 | }, 123 | }, 124 | "metafields": Array [ 125 | Object { 126 | "children": null, 127 | "imgix_url": "https://cosmic-s3.imgix.net/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg", 128 | "key": "image", 129 | "title": "Image", 130 | "type": "file", 131 | "url": "https://s3-us-west-2.amazonaws.com/cosmicjs/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg", 132 | "value": "9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg", 133 | }, 134 | ], 135 | "modified_at": "2018-05-17T17:44:12.977Z", 136 | "published_at": "2018-05-17T17:44:12.977Z", 137 | "slug": "john-doe", 138 | "status": "published", 139 | "title": "John Doe", 140 | "type_slug": "authors", 141 | }, 142 | "object_type": "authors", 143 | "title": "Author", 144 | "type": "object", 145 | "value": "5afdbf6c44d74b4e924f1d09", 146 | }, 147 | ], 148 | "modified_at": "2017-10-12T17:39:54.476Z", 149 | "published_at": "2018-05-17T17:44:12.979Z", 150 | "slug": "a-wonderful-blog-post-about-earth", 151 | "status": "published", 152 | "title": "A Wonderful Blog Post About Earth", 153 | "type_slug": "posts", 154 | }, 155 | }, 156 | "another-wonderful-blog-post-about-earth": Object { 157 | "post": Object { 158 | "_id": "5afdbf6c44d74b4e924f1d0d", 159 | "bucket": "5afdbcd115bef94f7421eb0d", 160 | "content": "That's one small step for [a] man, one giant leap for mankind.
To be the first to enter the cosmos, to engage, single-handed, in an unprecedented duel with nature—could one dream of anything more?
The dreams of yesterday are the hopes of today and the reality of tomorrow.
The sky is the limit only for those who aren't afraid to fly!
Problems look mighty small from 150 miles up.
There can be no thought of finishing for ‘aiming for the stars.’ Both figuratively and literally, it is a task to occupy the generations. And no matter how much progress one makes, there is always the thrill of just beginning.
There can be no thought of finishing for ‘aiming for the stars.’ Both figuratively and literally, it is a task to occupy the generations. And no matter how much progress one makes, there is always the thrill of just beginning.
There can be no thought of finishing for ‘aiming for the stars.’ Both figuratively and literally, it is a task to occupy the generations. And no matter how much progress one makes, there is always the thrill of just beginning.
Houston, Tranquillity Base here. The Eagle has landed.
You know, being a test pilot isn't always the healthiest business in the world.
", 161 | "created": "2017-10-12T13:27:49.666Z", 162 | "created_at": "2017-10-12T13:27:49.666Z", 163 | "metadata": Object { 164 | "author": Object { 165 | "_id": "5afdbf6c44d74b4e924f1d06", 166 | "bucket": "5afdbcd115bef94f7421eb0d", 167 | "content": "Something about Jane...
", 168 | "created": "2017-10-12T13:27:49.663Z", 169 | "created_at": "2017-10-12T13:27:49.663Z", 170 | "metadata": Object { 171 | "image": Object { 172 | "imgix_url": "https://cosmic-s3.imgix.net/99f48cb0-23f5-11e7-875c-3f5dc9c15c2b-female.jpg", 173 | "url": "https://s3-us-west-2.amazonaws.com/cosmicjs/99f48cb0-23f5-11e7-875c-3f5dc9c15c2b-female.jpg", 174 | }, 175 | }, 176 | "metafields": Array [ 177 | Object { 178 | "children": null, 179 | "imgix_url": "https://cosmic-s3.imgix.net/99f48cb0-23f5-11e7-875c-3f5dc9c15c2b-female.jpg", 180 | "key": "image", 181 | "title": "Image", 182 | "type": "file", 183 | "url": "https://s3-us-west-2.amazonaws.com/cosmicjs/99f48cb0-23f5-11e7-875c-3f5dc9c15c2b-female.jpg", 184 | "value": "99f48cb0-23f5-11e7-875c-3f5dc9c15c2b-female.jpg", 185 | }, 186 | ], 187 | "modified_at": "2018-05-17T17:44:12.973Z", 188 | "published_at": "2018-05-17T17:44:12.973Z", 189 | "slug": "jane-doe", 190 | "status": "published", 191 | "title": "Jane Doe", 192 | "type_slug": "authors", 193 | }, 194 | "categories": Array [ 195 | null, 196 | null, 197 | ], 198 | "hero": Object { 199 | "imgix_url": "https://cosmic-s3.imgix.net/99fd6650-23f5-11e7-875c-3f5dc9c15c2b-beach.jpg", 200 | "url": "https://s3-us-west-2.amazonaws.com/cosmicjs/99fd6650-23f5-11e7-875c-3f5dc9c15c2b-beach.jpg", 201 | }, 202 | "teaser": "Science cuts two ways, of course; its products can be used for both good and evil. But there's no turning back from science. The early warnings about technological dangers also come from science.
Houston, Tranquillity Base here. The Eagle has landed...
", 203 | }, 204 | "metafields": Array [ 205 | Object { 206 | "children": null, 207 | "imgix_url": "https://cosmic-s3.imgix.net/99fd6650-23f5-11e7-875c-3f5dc9c15c2b-beach.jpg", 208 | "key": "hero", 209 | "title": "Hero", 210 | "type": "file", 211 | "url": "https://s3-us-west-2.amazonaws.com/cosmicjs/99fd6650-23f5-11e7-875c-3f5dc9c15c2b-beach.jpg", 212 | "value": "99fd6650-23f5-11e7-875c-3f5dc9c15c2b-beach.jpg", 213 | }, 214 | Object { 215 | "children": null, 216 | "key": "teaser", 217 | "title": "Teaser", 218 | "type": "html-textarea", 219 | "value": "Science cuts two ways, of course; its products can be used for both good and evil. But there's no turning back from science. The early warnings about technological dangers also come from science.
Houston, Tranquillity Base here. The Eagle has landed...
", 220 | }, 221 | Object { 222 | "children": null, 223 | "key": "author", 224 | "object": Object { 225 | "_id": "5afdbf6c44d74b4e924f1d06", 226 | "bucket": "5afdbcd115bef94f7421eb0d", 227 | "content": "Something about Jane...
", 228 | "created": "2017-10-12T13:27:49.663Z", 229 | "created_at": "2017-10-12T13:27:49.663Z", 230 | "metadata": Object { 231 | "image": Object { 232 | "imgix_url": "https://cosmic-s3.imgix.net/99f48cb0-23f5-11e7-875c-3f5dc9c15c2b-female.jpg", 233 | "url": "https://s3-us-west-2.amazonaws.com/cosmicjs/99f48cb0-23f5-11e7-875c-3f5dc9c15c2b-female.jpg", 234 | }, 235 | }, 236 | "metafields": Array [ 237 | Object { 238 | "children": null, 239 | "imgix_url": "https://cosmic-s3.imgix.net/99f48cb0-23f5-11e7-875c-3f5dc9c15c2b-female.jpg", 240 | "key": "image", 241 | "title": "Image", 242 | "type": "file", 243 | "url": "https://s3-us-west-2.amazonaws.com/cosmicjs/99f48cb0-23f5-11e7-875c-3f5dc9c15c2b-female.jpg", 244 | "value": "99f48cb0-23f5-11e7-875c-3f5dc9c15c2b-female.jpg", 245 | }, 246 | ], 247 | "modified_at": "2018-05-17T17:44:12.973Z", 248 | "published_at": "2018-05-17T17:44:12.973Z", 249 | "slug": "jane-doe", 250 | "status": "published", 251 | "title": "Jane Doe", 252 | "type_slug": "authors", 253 | }, 254 | "object_type": "authors", 255 | "title": "Author", 256 | "type": "object", 257 | "value": "5afdbf6c44d74b4e924f1d06", 258 | }, 259 | Object { 260 | "children": null, 261 | "key": "categories", 262 | "object_type": "categories", 263 | "objects": Array [ 264 | null, 265 | null, 266 | ], 267 | "title": "Categories", 268 | "type": "objects", 269 | "value": "58f565290687f7353b0009bb,58f565210687f7353b0009ba", 270 | }, 271 | ], 272 | "modified_at": "2018-05-17T17:44:12.981Z", 273 | "published_at": "2018-05-17T17:44:12.981Z", 274 | "slug": "another-wonderful-blog-post-about-earth", 275 | "status": "published", 276 | "title": "Another Wonderful Blog Post About Earth", 277 | "type_slug": "posts", 278 | }, 279 | }, 280 | } 281 | } 282 | /> 283 | `; 284 | -------------------------------------------------------------------------------- /components/AppBar/__snapshots__/AppBar.test.jsx.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`AppBar should render 1`] = ` 4 |I don't know what you could say about a day in which you have seen four beautiful sunsets.
It suddenly struck me that that tiny pea, pretty and blue, was the Earth. I put up my thumb and shut one eye, and my thumb blotted out the planet Earth. I didn't feel like a giant. I felt very, very small....
", 53 | } 54 | } 55 | metafields={ 56 | Array [ 57 | Object { 58 | "children": null, 59 | "imgix_url": "https://cosmic-s3.imgix.net/56363630-af74-11e7-b864-313f959a776e-react-blog.jpg", 60 | "key": "hero", 61 | "title": "Hero", 62 | "type": "file", 63 | "url": "https://s3-us-west-2.amazonaws.com/cosmicjs/56363630-af74-11e7-b864-313f959a776e-react-blog.jpg", 64 | "value": "56363630-af74-11e7-b864-313f959a776e-react-blog.jpg", 65 | }, 66 | Object { 67 | "children": null, 68 | "key": "teaser", 69 | "title": "Teaser", 70 | "type": "html-textarea", 71 | "value": "I don't know what you could say about a day in which you have seen four beautiful sunsets.
It suddenly struck me that that tiny pea, pretty and blue, was the Earth. I put up my thumb and shut one eye, and my thumb blotted out the planet Earth. I didn't feel like a giant. I felt very, very small....
", 72 | }, 73 | Object { 74 | "children": null, 75 | "key": "author", 76 | "object": Object { 77 | "_id": "5afdbf6c44d74b4e924f1d09", 78 | "bucket": "5afdbcd115bef94f7421eb0d", 79 | "content": "Something about John...
", 80 | "created": "2017-10-12T13:27:49.665Z", 81 | "created_at": "2017-10-12T13:27:49.665Z", 82 | "metadata": Object { 83 | "image": Object { 84 | "imgix_url": "https://cosmic-s3.imgix.net/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg", 85 | "url": "https://s3-us-west-2.amazonaws.com/cosmicjs/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg", 86 | }, 87 | }, 88 | "metafields": Array [ 89 | Object { 90 | "children": null, 91 | "imgix_url": "https://cosmic-s3.imgix.net/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg", 92 | "key": "image", 93 | "title": "Image", 94 | "type": "file", 95 | "url": "https://s3-us-west-2.amazonaws.com/cosmicjs/9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg", 96 | "value": "9a0a85b0-23f5-11e7-875c-3f5dc9c15c2b-male.jpg", 97 | }, 98 | ], 99 | "modified_at": "2018-05-17T17:44:12.977Z", 100 | "published_at": "2018-05-17T17:44:12.977Z", 101 | "slug": "john-doe", 102 | "status": "published", 103 | "title": "John Doe", 104 | "type_slug": "authors", 105 | }, 106 | "object_type": "authors", 107 | "title": "Author", 108 | "type": "object", 109 | "value": "5afdbf6c44d74b4e924f1d09", 110 | }, 111 | ] 112 | } 113 | modified_at="2017-10-12T17:39:54.476Z" 114 | published_at="2018-05-17T17:44:12.979Z" 115 | slug="a-wonderful-blog-post-about-earth" 116 | status="published" 117 | title="A Wonderful Blog Post About Earth" 118 | type_slug="posts" 119 | > 120 |