├── generators ├── store │ ├── templates │ │ ├── _test.js │ │ ├── _constants.ts │ │ ├── _state.ts │ │ ├── _sagas.ts │ │ ├── _reducer.ts │ │ ├── _selectors.ts │ │ └── _actions.ts │ └── index.js ├── component │ ├── templates │ │ ├── _i18n.json │ │ ├── _styles.scss │ │ ├── _component.js │ │ └── _test.js │ └── index.js ├── app │ ├── templates │ │ ├── src │ │ │ ├── pages │ │ │ │ ├── post │ │ │ │ │ ├── styles.scss │ │ │ │ │ └── index.tsx │ │ │ │ ├── posts │ │ │ │ │ ├── styles.scss │ │ │ │ │ └── index.tsx │ │ │ │ ├── index │ │ │ │ │ ├── styles.scss │ │ │ │ │ └── index.tsx │ │ │ │ ├── about │ │ │ │ │ ├── styles.scss │ │ │ │ │ └── index.tsx │ │ │ │ ├── _document.js │ │ │ │ └── _app.js │ │ │ ├── styles │ │ │ │ ├── _mixins.scss │ │ │ │ ├── _variables.scss │ │ │ │ ├── antd-custom.less │ │ │ │ └── main.scss │ │ │ ├── components │ │ │ │ ├── global │ │ │ │ │ ├── postItem │ │ │ │ │ │ ├── styles.scss │ │ │ │ │ │ └── index.tsx │ │ │ │ │ ├── postList │ │ │ │ │ │ ├── styles.scss │ │ │ │ │ │ └── index.tsx │ │ │ │ │ ├── commentItem │ │ │ │ │ │ ├── styles.scss │ │ │ │ │ │ └── index.tsx │ │ │ │ │ ├── commentList │ │ │ │ │ │ ├── styles.scss │ │ │ │ │ │ └── index.tsx │ │ │ │ │ ├── customErrorBoundary │ │ │ │ │ │ ├── index.tsx │ │ │ │ │ │ ├── styles.scss │ │ │ │ │ │ └── fallbackComponent.tsx │ │ │ │ │ ├── snazzyButton │ │ │ │ │ │ ├── index.tsx │ │ │ │ │ │ ├── styles.scss │ │ │ │ │ │ └── snazzyButton.stories.tsx │ │ │ │ │ ├── customnprogress │ │ │ │ │ │ └── index.tsx │ │ │ │ │ └── layout │ │ │ │ │ │ └── head.tsx │ │ │ │ └── index.ts │ │ │ ├── hocs │ │ │ │ └── index.ts │ │ │ ├── enums │ │ │ │ └── index.ts │ │ │ ├── hooks │ │ │ │ └── index.ts │ │ │ ├── contexts │ │ │ │ └── index.ts │ │ │ ├── .eslintignore │ │ │ ├── app-constants │ │ │ │ └── index.ts │ │ │ ├── config │ │ │ │ ├── testing.js │ │ │ │ ├── default.js │ │ │ │ ├── development.js │ │ │ │ ├── production.js │ │ │ │ └── custom-environment-variables.js │ │ │ ├── models │ │ │ │ ├── loadable.d.ts │ │ │ │ ├── post.d.ts │ │ │ │ ├── dispatchable.d.ts │ │ │ │ ├── comment.d.ts │ │ │ │ └── index.d.ts │ │ │ ├── static │ │ │ │ ├── favicon.ico │ │ │ │ ├── images │ │ │ │ │ ├── the-team.JPG │ │ │ │ │ └── analyticsfire-logo.svg │ │ │ │ └── locales │ │ │ │ │ └── en │ │ │ │ │ ├── home.json │ │ │ │ │ ├── common.json │ │ │ │ │ └── about.json │ │ │ ├── .prettierrc │ │ │ ├── tests │ │ │ │ └── units │ │ │ │ │ ├── setup │ │ │ │ │ ├── index.js │ │ │ │ │ └── assetsTransformer.js │ │ │ │ │ ├── components │ │ │ │ │ ├── __snapshots__ │ │ │ │ │ │ └── activeLink.test.js.snap │ │ │ │ │ └── activeLink.test.js │ │ │ │ │ ├── pages │ │ │ │ │ ├── home.test.js │ │ │ │ │ ├── about.test.js │ │ │ │ │ └── __snapshots__ │ │ │ │ │ │ ├── home.test.js.snap │ │ │ │ │ │ └── about.test.js.snap │ │ │ │ │ └── jest.config.js │ │ │ ├── redux-store │ │ │ │ ├── rootSaga.ts │ │ │ │ ├── storeState.ts │ │ │ │ ├── posts │ │ │ │ │ ├── state.ts │ │ │ │ │ ├── constants.ts │ │ │ │ │ ├── sagas.ts │ │ │ │ │ ├── reducer.ts │ │ │ │ │ ├── selectors.ts │ │ │ │ │ └── actions.ts │ │ │ │ ├── rootReducer.ts │ │ │ │ └── createStore.ts │ │ │ ├── lib │ │ │ │ ├── config.shim.js │ │ │ │ └── withI18next.js │ │ │ ├── typings │ │ │ │ ├── storybook.react.d.ts │ │ │ │ └── react-redux.d.ts │ │ │ ├── .gitignore │ │ │ ├── api │ │ │ │ └── postsApi.js │ │ │ ├── .eslintrc │ │ │ ├── utils │ │ │ │ └── index.ts │ │ │ ├── .babelrc │ │ │ ├── tsconfig.json │ │ │ ├── LICENCE │ │ │ ├── tslint.json │ │ │ ├── server.js │ │ │ ├── .gitattributes │ │ │ ├── i18n.js │ │ │ ├── next.config.js │ │ │ └── README.md │ │ ├── _layout.tsx │ │ └── _package.json │ └── index.js ├── page │ ├── templates │ │ ├── _styles.scss │ │ ├── _i18n.json │ │ ├── _index.js │ │ ├── _test.js │ │ └── _page.js │ └── index.js ├── enum │ ├── templates │ │ └── _enum.ts │ └── index.js ├── model │ ├── templates │ │ └── _model.ts │ └── index.js ├── hook │ ├── templates │ │ └── _hook.ts │ └── index.js ├── context │ ├── templates │ │ └── _context.ts │ └── index.js ├── hoc │ ├── templates │ │ └── _hoc.ts │ └── index.js └── action │ └── index.js ├── .eslintignore ├── .gitignore ├── .prettierignore ├── .prettierrc ├── .vscode └── settings.json ├── .eslintrc ├── LICENCE ├── CHANGELOG.md ├── package.json └── README.md /generators/store/templates/_test.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /generators/component/templates/_i18n.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | 2 | /node_modules/** 3 | /templates/** -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .vscode 3 | .idea 4 | -------------------------------------------------------------------------------- /generators/app/templates/src/pages/post/styles.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /generators/app/templates/src/pages/posts/styles.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /generators/app/templates/src/styles/_mixins.scss: -------------------------------------------------------------------------------- 1 | // App Mixins -------------------------------------------------------------------------------- /generators/app/templates/src/components/global/postItem/styles.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /generators/app/templates/src/components/global/postList/styles.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /generators/app/templates/src/styles/_variables.scss: -------------------------------------------------------------------------------- 1 | // App Variables -------------------------------------------------------------------------------- /generators/page/templates/_styles.scss: -------------------------------------------------------------------------------- 1 | // .<%= className %> {} 2 | -------------------------------------------------------------------------------- /generators/app/templates/src/components/global/commentItem/styles.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /generators/app/templates/src/components/global/commentList/styles.scss: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /generators/app/templates/src/hocs/index.ts: -------------------------------------------------------------------------------- 1 | /* new-hoc-import-goes-here */ -------------------------------------------------------------------------------- /generators/app/templates/src/pages/index/styles.scss: -------------------------------------------------------------------------------- 1 | // .home-page {} 2 | -------------------------------------------------------------------------------- /generators/component/templates/_styles.scss: -------------------------------------------------------------------------------- 1 | // .<%= className %> {} 2 | -------------------------------------------------------------------------------- /generators/app/templates/src/pages/about/styles.scss: -------------------------------------------------------------------------------- 1 | // .about-page {} 2 | -------------------------------------------------------------------------------- /generators/page/templates/_i18n.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "<%= title %>" 3 | } 4 | -------------------------------------------------------------------------------- /generators/app/templates/src/enums/index.ts: -------------------------------------------------------------------------------- 1 | /* new-enum-import-goes-here */ 2 | -------------------------------------------------------------------------------- /generators/app/templates/src/hooks/index.ts: -------------------------------------------------------------------------------- 1 | /* new-hook-import-goes-here */ 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | _*.js 2 | _*.scss 3 | _*.json 4 | generators/app/templates/src/LICENCE -------------------------------------------------------------------------------- /generators/app/templates/src/contexts/index.ts: -------------------------------------------------------------------------------- 1 | /* new-context-import-goes-here */ 2 | -------------------------------------------------------------------------------- /generators/app/templates/src/.eslintignore: -------------------------------------------------------------------------------- 1 | /.next/** 2 | /.out/** 3 | /node_modules/** 4 | -------------------------------------------------------------------------------- /generators/app/templates/src/app-constants/index.ts: -------------------------------------------------------------------------------- 1 | /* new-constant-export-goes-here */ 2 | -------------------------------------------------------------------------------- /generators/app/templates/src/config/testing.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: 'testing', 3 | }; 4 | -------------------------------------------------------------------------------- /generators/app/templates/src/config/default.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: 'development', 3 | }; 4 | -------------------------------------------------------------------------------- /generators/enum/templates/_enum.ts: -------------------------------------------------------------------------------- 1 | export enum <%= enumName %> { 2 | DefaultValue = 1, 3 | } 4 | 5 | -------------------------------------------------------------------------------- /generators/app/templates/src/config/development.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: 'development', 3 | }; 4 | -------------------------------------------------------------------------------- /generators/app/templates/src/config/production.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: 'production', 3 | }; 4 | -------------------------------------------------------------------------------- /generators/app/templates/src/styles/antd-custom.less: -------------------------------------------------------------------------------- 1 | @import '~antd/dist/antd.less'; 2 | @import './themes/theme.less'; -------------------------------------------------------------------------------- /generators/app/templates/src/config/custom-environment-variables.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: 'NODE_ENV', 3 | }; 4 | -------------------------------------------------------------------------------- /generators/app/templates/src/models/loadable.d.ts: -------------------------------------------------------------------------------- 1 | export interface ILoadable { 2 | readonly isLoading: boolean; 3 | } 4 | -------------------------------------------------------------------------------- /generators/model/templates/_model.ts: -------------------------------------------------------------------------------- 1 | 2 | export interface <%= interfaceName %> { 3 | readonly id: string; 4 | } 5 | -------------------------------------------------------------------------------- /generators/hook/templates/_hook.ts: -------------------------------------------------------------------------------- 1 | export const <%= hookName %> = () => { 2 | // Put your logic here 3 | 4 | return null; 5 | }; 6 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "tabWidth": 2, 4 | "trailingComma": "all", 5 | "printWidth": 120, 6 | "bracketSpacing": true 7 | } -------------------------------------------------------------------------------- /generators/app/templates/src/models/post.d.ts: -------------------------------------------------------------------------------- 1 | export interface IPost { 2 | readonly id: string; 3 | readonly title: string; 4 | readonly body: string; 5 | } 6 | -------------------------------------------------------------------------------- /generators/app/templates/src/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronHacked/nextjs-typescript-antd/HEAD/generators/app/templates/src/static/favicon.ico -------------------------------------------------------------------------------- /generators/app/templates/src/models/dispatchable.d.ts: -------------------------------------------------------------------------------- 1 | import { Dispatch } from 'redux'; 2 | 3 | export interface IDispatchable { 4 | readonly dispatch: Dispatch | any; 5 | } 6 | -------------------------------------------------------------------------------- /generators/app/templates/src/static/images/the-team.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElectronHacked/nextjs-typescript-antd/HEAD/generators/app/templates/src/static/images/the-team.JPG -------------------------------------------------------------------------------- /generators/page/templates/_index.js: -------------------------------------------------------------------------------- 1 | import Component, { <%= component %> } from './<%= nameWithLowerCase %>'; 2 | 3 | export { <%= component %> }; 4 | export default Component; 5 | -------------------------------------------------------------------------------- /generators/app/templates/src/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "tabWidth": 2, 4 | "trailingComma": "es5", 5 | "printWidth": 120, 6 | "bracketSpacing": true 7 | } 8 | -------------------------------------------------------------------------------- /generators/app/templates/src/tests/units/setup/index.js: -------------------------------------------------------------------------------- 1 | const enzyme = require('enzyme'); 2 | const Adapter = require('enzyme-adapter-react-16'); 3 | 4 | enzyme.configure({ adapter: new Adapter() }); 5 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "workbench.colorCustomizations": { 3 | "activityBar.background": "#0F3429", 4 | "titleBar.activeBackground": "#154939", 5 | "titleBar.activeForeground": "#F3FCF9" 6 | } 7 | } -------------------------------------------------------------------------------- /generators/app/templates/src/static/locales/en/home.json: -------------------------------------------------------------------------------- 1 | { 2 | "pageTitle": "AnalyticsFire - Home Page", 3 | "title": 4 | "This page was made using NextJs. It's currently running in {{ env }} mode!" 5 | } 6 | -------------------------------------------------------------------------------- /generators/app/templates/src/models/comment.d.ts: -------------------------------------------------------------------------------- 1 | export interface IComment { 2 | readonly id: number; 3 | readonly postId: string; 4 | readonly name: string; 5 | readonly email: string; 6 | readonly body: string; 7 | } 8 | -------------------------------------------------------------------------------- /generators/app/templates/src/redux-store/rootSaga.ts: -------------------------------------------------------------------------------- 1 | import postsSaga from './posts/sagas'; 2 | /* new-imported-saga-goes-here */ 3 | 4 | export default [ 5 | postsSaga, 6 | /* new-imported-saga-element-goes-here */ 7 | ]; 8 | -------------------------------------------------------------------------------- /generators/app/templates/src/tests/units/setup/assetsTransformer.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | 3 | module.exports = { 4 | process(src, filename) { 5 | return `module.exports = ${JSON.stringify(path.basename(filename))};`; 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /generators/app/templates/src/models/index.d.ts: -------------------------------------------------------------------------------- 1 | export { IComment } from './comment'; 2 | export { IPost } from './post'; 3 | export { ILoadable } from './loadable'; 4 | export { IDispatchable } from './dispatchable'; 5 | /* new-interface-import-goes-here */ 6 | -------------------------------------------------------------------------------- /generators/app/templates/src/redux-store/storeState.ts: -------------------------------------------------------------------------------- 1 | import { IPostsState } from './posts/state'; 2 | /* new-imported-state-goes-here */ 3 | 4 | export interface IStoreState { 5 | readonly posts: IPostsState; 6 | /* new-imported-state-key-goes-here */ 7 | } 8 | -------------------------------------------------------------------------------- /generators/app/templates/src/tests/units/components/__snapshots__/activeLink.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`ActiveLink is rendered 1`] = ` 4 | 8 | Home 9 | 10 | `; 11 | -------------------------------------------------------------------------------- /generators/app/templates/src/lib/config.shim.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-underscore-dangle */ 2 | import { get, has } from 'lodash'; 3 | 4 | export default { 5 | get: key => get(window.__CONFIG__, key), 6 | has: key => has(window.__CONFIG__, key), 7 | }; 8 | /* eslint-enable no-underscore-dangle */ 9 | -------------------------------------------------------------------------------- /generators/context/templates/_context.ts: -------------------------------------------------------------------------------- 1 | import { createContext } from 'react'; 2 | 3 | interface I<%= contextName %> {} 4 | 5 | export const default<%= contextName %>: I<%= contextName %> = { 6 | 7 | }; 8 | 9 | export const <%= contextName %> = createContext>(default<%= contextName %>); -------------------------------------------------------------------------------- /generators/app/templates/src/static/locales/en/common.json: -------------------------------------------------------------------------------- 1 | { 2 | "copyright": 3 | "Analytics Fire, 507 Homer Ave, Palo Alto, California 94301 <1> <3>© 2016 New Dawn Analytics Inc", 4 | "nav": { 5 | "home": "Home", 6 | "about": "About", 7 | "redux": "Redux Example" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /generators/app/templates/src/typings/storybook.react.d.ts: -------------------------------------------------------------------------------- 1 | import { RenderFunction, DecoratorParameters } from '@storybook/react'; 2 | 3 | declare module '@storybook/react' { 4 | export interface Story { 5 | addWithJSX(storyName: string, callback: RenderFunction, parameters?: DecoratorParameters): this; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /generators/component/templates/_component.js: -------------------------------------------------------------------------------- 1 | import React, {FC} from 'react'; 2 | import './styles.scss'; 3 | 4 | interface IProps {}; 5 | 6 | export const <%= component %>: FC = () => ( 7 |
8 | <%= component %> component 9 |
10 | ); 11 | 12 | export default <%= component %>; 13 | -------------------------------------------------------------------------------- /generators/app/templates/src/pages/index/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Layout from 'components/global/layout'; 3 | import './styles.scss'; 4 | 5 | export const Home = () => ( 6 | 7 |

This is is the home page

8 |
9 | ); 10 | 11 | export default Home; 12 | -------------------------------------------------------------------------------- /generators/app/templates/src/pages/about/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Layout from 'components/global/layout'; 3 | import './styles.scss'; 4 | 5 | export const About = () => ( 6 | 7 |

8 | This is the About Us page 9 |

10 |
11 | ); 12 | 13 | export default About; 14 | -------------------------------------------------------------------------------- /generators/app/templates/src/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | /build 11 | /dist 12 | /.next 13 | /.out 14 | 15 | # misc 16 | .DS_Store 17 | .env 18 | npm-debug.log* 19 | yarn-debug.log* 20 | yarn-error.log* 21 | 22 | # Don't add any ide-related generated files 23 | .vscode 24 | .sonarlint -------------------------------------------------------------------------------- /generators/app/templates/src/tests/units/pages/home.test.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | 3 | import React from 'react'; 4 | import toJson from 'enzyme-to-json'; 5 | import { shallow } from 'enzyme'; 6 | import { Home } from '@root/pages/home'; 7 | 8 | const defaultComponent = {}} />; 9 | 10 | test('Home is rendered', () => { 11 | expect(toJson(shallow(defaultComponent))).toMatchSnapshot(); 12 | }); 13 | 14 | /* eslint-enable no-undef */ 15 | -------------------------------------------------------------------------------- /generators/app/templates/src/typings/react-redux.d.ts: -------------------------------------------------------------------------------- 1 | import 'react-redux'; 2 | import {AnyAction} from 'redux'; 3 | import {Component} from 'react'; 4 | 5 | declare module 'react-redux' { 6 | // Add removed inferrable type to support connect as decorator 7 | // https://github.com/DefinitelyTyped/DefinitelyTyped/pull/16652 8 | export interface InferableComponentDecorator { 9 | >(component: T): T; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /generators/app/templates/src/tests/units/pages/about.test.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | 3 | import React from 'react'; 4 | import toJson from 'enzyme-to-json'; 5 | import { shallow } from 'enzyme'; 6 | import { About } from '@root/pages/about'; 7 | 8 | const defaultComponent = {}} />; 9 | 10 | test('About is rendered', () => { 11 | expect(toJson(shallow(defaultComponent))).toMatchSnapshot(); 12 | }); 13 | 14 | /* eslint-enable no-undef */ 15 | -------------------------------------------------------------------------------- /generators/app/templates/src/tests/units/pages/__snapshots__/home.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Home is rendered 1`] = ` 4 | 7 |
10 |

13 | 17 |

18 |
19 | `; 20 | -------------------------------------------------------------------------------- /generators/page/templates/_test.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | 3 | import React from 'react'; 4 | import toJson from 'enzyme-to-json'; 5 | import { shallow } from 'enzyme'; 6 | import { <%= component %> } from '@root/pages/<%= decamelizedName %>'; 7 | 8 | const defaultComponent = <<%= component %> t={() => {}} />; 9 | 10 | test('<%= component %> is rendered', () => { 11 | expect(toJson(shallow(defaultComponent))).toMatchSnapshot(); 12 | }); 13 | 14 | /* eslint-enable no-undef */ 15 | -------------------------------------------------------------------------------- /generators/component/templates/_test.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | 3 | import React from 'react'; 4 | import toJson from 'enzyme-to-json'; 5 | import { shallow } from 'enzyme'; 6 | import { <%= component %> } from '@root/components/<%= camelCasedName %>'; 7 | 8 | const defaultComponent = <<%= component %> t={() => {}} />; 9 | 10 | test('<%= component %> is rendered', () => { 11 | expect(toJson(shallow(defaultComponent))).toMatchSnapshot(); 12 | }); 13 | 14 | /* eslint-enable no-undef */ 15 | -------------------------------------------------------------------------------- /generators/app/templates/src/api/postsApi.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | 3 | const BASE_URL = 'https://jsonplaceholder.typicode.com'; 4 | 5 | export const fetchAllPostsApi = () => 6 | axios 7 | .get(`${BASE_URL}/posts`) 8 | .then(response => response) 9 | .catch(error => error.response); 10 | 11 | export const fetchPostCommentsApi = postId => 12 | axios 13 | .get(`${BASE_URL}/posts/${postId}/comments`) 14 | .then(response => response) 15 | .catch(error => error.response); 16 | -------------------------------------------------------------------------------- /generators/app/templates/src/tests/units/pages/__snapshots__/about.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`About is rendered 1`] = ` 4 | 7 |
10 |

13 |
16 |

19 |

20 |
21 | `; 22 | -------------------------------------------------------------------------------- /generators/page/templates/_page.js: -------------------------------------------------------------------------------- 1 | import React, {FC} from 'react'; 2 | import Layout from 'components/global/layout'; 3 | import './styles.scss'; 4 | 5 | interface IProps {}; 6 | 7 | export const <%= component %>: FC = () => ( 8 | 9 |
10 |

11 | This is the <%= title %> page 12 |

13 |
14 |
15 | ); 16 | 17 | export default <%= component %>; 18 | -------------------------------------------------------------------------------- /generators/app/templates/src/components/index.ts: -------------------------------------------------------------------------------- 1 | export { default as CommentItem } from './global/commentItem'; 2 | export { default as CommentList } from './global/commentList'; 3 | export { default as CustomNProgress } from './global/customNProgress'; 4 | export { default as Layout } from './global/layout'; 5 | export { default as PostItem } from './global/postItem'; 6 | export { default as PostList } from './global/postList'; 7 | export { default as CustomErrorBoundary } from './global/customErrorBoundary'; 8 | /* new-component-import-goes-here */ 9 | -------------------------------------------------------------------------------- /generators/app/templates/src/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "standard", 4 | "plugin:react/recommended", 5 | "prettier", 6 | "prettier/react", 7 | "prettier/standard" 8 | ], 9 | "plugins": [ 10 | "react", 11 | "prettier", 12 | "standard" 13 | ], 14 | "parserOptions": { 15 | "sourceType": "module", 16 | "ecmaFeatures": { 17 | "jsx": true 18 | } 19 | }, 20 | "env": { 21 | "es6": true, 22 | "node": true 23 | }, 24 | "rules": { 25 | "prettier/prettier": ["error", { "singleQuote": true }] 26 | } 27 | } -------------------------------------------------------------------------------- /generators/app/templates/src/components/global/customErrorBoundary/index.tsx: -------------------------------------------------------------------------------- 1 | import React, { FC, ReactNode } from 'react'; 2 | import ErrorBoundary from 'react-error-boundary'; 3 | import CustomErrorBoundaryFallbackComponent from './fallbackComponent'; 4 | import './styles.scss'; 5 | 6 | interface IProps { 7 | children: ReactNode; 8 | } 9 | 10 | export const CustomErrorBoundary: FC = ({ children }) => { 11 | return {children}; 12 | }; 13 | 14 | export default CustomErrorBoundary; 15 | -------------------------------------------------------------------------------- /generators/hoc/templates/_hoc.ts: -------------------------------------------------------------------------------- 1 | import React, { FC, ComponentType } from 'react'; 2 | 3 | /** 4 | * 5 | * @param Component - the component that is passed into the HOC can be either a function component or class component. 6 | * 7 | * @see https://medium.com/@jrwebdev/react-higher-order-component-patterns-in-typescript-42278f7590fb 8 | */ 9 | 10 | const <%= hocName %> =

(Component: ComponentType

): FC

=> (props: P) => { 11 | // Your logic comes up in here 12 | 13 | return ; 14 | }; 15 | 16 | export default <%= hocName %>; 17 | -------------------------------------------------------------------------------- /generators/store/templates/_constants.ts: -------------------------------------------------------------------------------- 1 | export const DEFAULT_ACTION = 'DEFAULT_ACTION'; 2 | 3 | //#region Reset doable for this state 4 | export const RESET_<%= STATE_NAME %>_DOABLES = 'RESET_<%= STATE_NAME %>_DOABLES'; 5 | export const TOGGLE_<%= STATE_NAME %>_BOOLEANABLE_STATE = 'TOGGLE_<%= STATE_NAME %>_BOOLEANABLE_STATE'; 6 | export const TOGGLE_<%= STATE_NAME %>_ERRABLE_STATE = 'TOGGLE_<%= STATE_NAME %>_ERRABLE_STATE'; 7 | export const TOGGLE_<%= STATE_NAME %>_SUCCESSIBLE_STATE = 'TOGGLE_<%= STATE_NAME %>_SUCCESSIBLE_STATE'; 8 | //#endregion 9 | 10 | /* new-constant-export-goes-here */ -------------------------------------------------------------------------------- /generators/app/templates/src/tests/units/components/activeLink.test.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-undef */ 2 | 3 | import React from 'react'; 4 | import toJson from 'enzyme-to-json'; 5 | import { render } from 'enzyme'; 6 | import { ActiveLink } from '@root/components/activeLink'; 7 | 8 | const defaultComponent = ( 9 | 10 | Home 11 | 12 | ); 13 | 14 | test('ActiveLink is rendered', () => { 15 | expect(toJson(render(defaultComponent))).toMatchSnapshot(); 16 | }); 17 | 18 | /* eslint-enable no-undef */ 19 | -------------------------------------------------------------------------------- /generators/app/templates/src/components/global/snazzyButton/index.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import './styles.scss'; 3 | 4 | interface IProps extends React.CSSProperties { 5 | /** 6 | * The text of the button 7 | */ 8 | text?: string; 9 | disabled?: boolean; 10 | onClick?: () => any; 11 | } 12 | 13 | const SnazzyButton: React.FC = ({ text, disabled = false, ...styles }) => { 14 | return ( 15 | 18 | ); 19 | }; 20 | 21 | SnazzyButton.displayName = 'SnazzyButton'; 22 | 23 | export default SnazzyButton; 24 | -------------------------------------------------------------------------------- /generators/app/templates/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Returns the parameter value, from the url, by name 3 | * @param {string} name Parameter name 4 | * @param {string} url The url 5 | * @returns {string} The value of this parameter 6 | */ 7 | export const getParameterByName = (name: string, url: string) => { 8 | if (!url) url = window.location.href; 9 | name = name.replace(/[\[\]]/g, '\\$&'); 10 | var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), 11 | results = regex.exec(url); 12 | if (!results) return null; 13 | if (!results[2]) return ''; 14 | return decodeURIComponent(results[2].replace(/\+/g, ' ')); 15 | }; 16 | -------------------------------------------------------------------------------- /generators/app/templates/src/tests/units/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | verbose: true, 3 | rootDir: '.', 4 | testMatch: [ 5 | '/pages/**/?(*.)test.js?(x)', 6 | '/components/**/?(*.)test.js?(x)', 7 | ], 8 | setupTestFrameworkScriptFile: '/setup/index.js', 9 | moduleNameMapper: { 10 | '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': 11 | '/setup/assetsTransformer.js', 12 | '\\.(css|scss|less)$': '/setup/assetsTransformer.js', 13 | '^@root(.*)$': '/../..$1', 14 | }, 15 | setupFiles: ['jest-plugin-context/setup'], 16 | }; 17 | -------------------------------------------------------------------------------- /generators/app/templates/src/components/global/commentItem/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Card } from 'antd'; 3 | import { IComment } from 'models'; 4 | import './styles.scss'; 5 | 6 | interface IProps { 7 | readonly comment: IComment; 8 | } 9 | 10 | const CommentItem: React.SFC = ({ comment }) => { 11 | const { name, body } = comment; 12 | 13 | return ( 14 | 15 |

16 |

{body}

17 |

{name}

18 |
19 | 20 | ); 21 | }; 22 | 23 | export default CommentItem; 24 | -------------------------------------------------------------------------------- /generators/app/templates/src/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["next/babel", "@zeit/next-typescript/babel"], 3 | "plugins": [ 4 | [ 5 | "module-resolver", 6 | { 7 | "root": ["./"], 8 | "alias": { 9 | "api": "./api", 10 | "app-constants": "./app-constants", 11 | "enums": "./enums", 12 | "hocs": "./hocs", 13 | "hooks": "./hooks", 14 | "components": "./components", 15 | "redux-store": "./redux-store" 16 | } 17 | } 18 | ], 19 | [ 20 | "import", 21 | { 22 | "libraryName": "antd", 23 | "style": true 24 | } 25 | ] 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /generators/app/templates/src/styles/main.scss: -------------------------------------------------------------------------------- 1 | // Project variables and Mixins 2 | @import 'variables'; 3 | @import 'mixins'; 4 | 5 | // Main Styles 6 | main { 7 | min-height: 100vh; 8 | padding-top: 91px; 9 | padding-bottom: 112px; 10 | } 11 | 12 | .title { 13 | font-weight: normal; 14 | letter-spacing: 1.1px; 15 | } 16 | 17 | #__next { 18 | display: flex; 19 | height: 100vh; 20 | } 21 | 22 | .layout { 23 | min-height: 100vh; 24 | 25 | .ant-layout-content { 26 | padding: 0 50px; 27 | } 28 | 29 | .content-body { 30 | background: #fff; 31 | padding: 24px; 32 | height: 70vh; 33 | } 34 | 35 | .ant-layout-footer { 36 | text-align: center; 37 | } 38 | } -------------------------------------------------------------------------------- /generators/app/templates/src/components/global/customnprogress/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Head from 'next/head'; 3 | import NProgress from 'nprogress'; 4 | import Router from 'next/router'; 5 | 6 | NProgress.configure({ showSpinner: false }); 7 | 8 | Router.onRouteChangeStart = _ => { 9 | NProgress.start(); 10 | }; 11 | 12 | Router.onRouteChangeComplete = () => NProgress.done(); 13 | Router.onRouteChangeError = () => NProgress.done(); 14 | 15 | export default () => ( 16 |
17 | 18 | {/* Import CSS for nprogress */} 19 | 20 | 21 |
22 | ); 23 | -------------------------------------------------------------------------------- /generators/app/templates/src/static/locales/en/about.json: -------------------------------------------------------------------------------- 1 | { 2 | "pageTitle": "AnalyticsFire - About me", 3 | "title": "Analytics Fire started with a simple goal", 4 | "goal": "\"To help innovative smart device manufacturers bring complex system products to market.\"", 5 | "how": "In order to do this, we've developed a laser-like focus on all the specific skills necessary to design, build, and maintain complex IoT applications, while simultaneously developing a technology-agnostic practice that requires mastery of both the newest modern technologies (eg: MQTT, Cassandra, and React.js) as well as stable platform technologies already in place throughout the enterprise (eg: SCADA, PI Server, Salesforce Platform, and others)." 6 | } -------------------------------------------------------------------------------- /generators/app/templates/src/components/global/customErrorBoundary/styles.scss: -------------------------------------------------------------------------------- 1 | $big-font: 45px; 2 | $primary-font: 26px; 3 | $secondary-font: 18px; 4 | 5 | .custom-error-boundary { 6 | display: flex; 7 | flex: 1; 8 | flex-direction: column; 9 | justify-content: center; 10 | align-items: center; 11 | justify-items: center; 12 | align-content: center; 13 | 14 | 15 | .oops { 16 | font-size: $big-font; 17 | } 18 | 19 | .error-icon { 20 | margin-top: 15px; 21 | font-size: $big-font; 22 | } 23 | 24 | .primary-message { 25 | font-size: $primary-font; 26 | } 27 | 28 | .secondary-message { 29 | font-size: $secondary-font; 30 | } 31 | 32 | .take-me-home { 33 | margin-bottom: $big-font; 34 | } 35 | } -------------------------------------------------------------------------------- /generators/app/templates/src/pages/_document.js: -------------------------------------------------------------------------------- 1 | // ./pages/_document.js 2 | import React from 'react'; 3 | import Document, {Head, Main, NextScript} from 'next/document'; 4 | import htmlescape from 'htmlescape'; 5 | import config from 'config'; 6 | 7 | export default class MyDocument extends Document { 8 | render () { 9 | return ( 10 | 11 | 12 | 13 |
14 |