Speech as a package #416
5 changed files with 8933 additions and 8444 deletions
|
@ -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 (
|
||||
|
|
|
@ -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
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
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue