Speech as a package #416

Merged
bones7242 merged 89 commits from speech-as-a-package into master 2018-04-18 21:47:34 +02:00
5 changed files with 8933 additions and 8444 deletions
Showing only changes of commit d937a4601f - Show all commits

View file

@ -1,12 +1,14 @@
import React from 'react';
import { Route, Switch } from 'react-router-dom';
import HomePage from 'pages/HomePage';
import AboutPage from 'pages/AboutPage';
import { dynamicImport } from 'utils/dynamicImport';
// import HomePage from 'pages/HomePage';
// import AboutPage from 'pages/AboutPage';
import LoginPage from 'pages/LoginPage';
import ShowPage from 'pages/ShowPage';
import FourOhFourPage from 'containers/FourOhFourPage';
// import { dynamicImport } from 'utils/dynamicImport';
// const HomePage = dynamicImport('pages/HomePage'); // or use the provided local homepage
const HomePage = dynamicImport('pages/HomePage') || require('pages/HomePage').default;
const AboutPage = dynamicImport('pages/AboutPage') || require('pages/AboutPage').default;
const App = () => {
return (

View file

@ -1,6 +1,10 @@
const { customComponents } = require('../../config/siteConfig.js');
const { customComponents } = require('siteConfig.js');
function getDeepestChildValue (parent, childrenKeys) {
if (!parent[childrenKeys[0]]) {
console.log('NO PAGE FOUND FOR:', childrenKeys[0], 'in', parent);
return null;
}
let childKey = childrenKeys.shift(); // .shift() retrieves the first element of array and removes it from array
let child = parent[childKey];
if (childrenKeys.length >= 1) {
@ -20,7 +24,7 @@ export const dynamicImport = (filePath) => {
throw new Error('file path provided to dynamicImport() must be a string');
}
if (!customComponents) {
return require(`${filePath}`);
return null;
}
// split out the file folders // filter out any empty or white-space-only strings
const folders = filePath.split('/').filter(folderName => folderName.replace(/\s/g, '').length);
@ -30,6 +34,6 @@ export const dynamicImport = (filePath) => {
if (component) {
return component; // return custom component
} else {
return require(`${filePath}`);
return null;
}
};

11463
index.js

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,13 @@
const Server = require('./server');
const Pages = require('./client/pages');
const Components = require('./client/components');
const Containers = require('./client/containers');
const exports = {
Server,
Pages,
Components,
Containers,
};
module.exports = exports;