From 4d920d643e151c08ef08dd80babfd4e420139a80 Mon Sep 17 00:00:00 2001 From: maxceem Date: Wed, 13 Jan 2021 10:25:05 +0200 Subject: [PATCH 1/7] fix: show "TBD" is no date range ref issue #53 --- src/utils/format.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils/format.js b/src/utils/format.js index 54de66f9..47435e12 100644 --- a/src/utils/format.js +++ b/src/utils/format.js @@ -161,5 +161,9 @@ export const formatDateRange = (startDate, endDate) => { const startDateStr = startDate ? moment(startDate).format(DAY_FORMAT) : ""; const endDateStr = endDate ? moment(endDate).format(DAY_FORMAT) : ""; + if (!startDateStr && !endDateStr) { + return "TBD"; + } + return `${startDateStr} - ${endDateStr}`; }; From dec233ca2a677ed464edabeaf1c30c58e29d69f8 Mon Sep 17 00:00:00 2001 From: maxceem Date: Mon, 18 Jan 2021 11:10:27 +0200 Subject: [PATCH 2/7] chore: use "APPENV" to config environment --- config/{development.js => dev.js} | 0 config/index.js | 6 +++--- config/{production.js => prod.js} | 0 3 files changed, 3 insertions(+), 3 deletions(-) rename config/{development.js => dev.js} (100%) rename config/{production.js => prod.js} (100%) diff --git a/config/development.js b/config/dev.js similarity index 100% rename from config/development.js rename to config/dev.js diff --git a/config/index.js b/config/index.js index d89d9220..0de81581 100644 --- a/config/index.js +++ b/config/index.js @@ -1,11 +1,11 @@ /* global process */ module.exports = (() => { - const env = process.env.NODE_ENV || "development"; + const env = process.env.APPENV || "dev"; // for security reason don't let to require any arbitrary file defined in process.env - if (["production", "development"].indexOf(env) < 0) { - return require("./development"); + if (["prod", "dev"].indexOf(env) < 0) { + return require("./dev"); } return require("./" + env); diff --git a/config/production.js b/config/prod.js similarity index 100% rename from config/production.js rename to config/prod.js From be2d73c3f65b5d53ea782644707d2a28ecc123fd Mon Sep 17 00:00:00 2001 From: yoution Date: Tue, 19 Jan 2021 12:33:11 +0800 Subject: [PATCH 3/7] fix: issue #13 --- babel.config.js | 59 +++++++++++++++++++++++++++++++++++++++++++++++ babel.config.json | 51 ---------------------------------------- webpack.config.js | 5 +++- 3 files changed, 63 insertions(+), 52 deletions(-) create mode 100644 babel.config.js delete mode 100644 babel.config.json diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 00000000..07815e13 --- /dev/null +++ b/babel.config.js @@ -0,0 +1,59 @@ +module.exports = function (api) { + const isProd = process.env.APPMODE === "production"; + api.cache(!isProd); + + const generateScopedName = isProd + ? "[hash:base64:6]" + : "teams_[path][name]___[local]___[hash:base64:6]"; + return { + presets: ["@babel/preset-env", "@babel/preset-react"], + plugins: [ + [ + "@babel/plugin-transform-runtime", + { + useESModules: true, + regenerator: false, + }, + ], + [ + "react-css-modules", + { + filetypes: { + ".scss": { + syntax: "postcss-scss", + }, + }, + generateScopedName, + }, + ], + "inline-react-svg", + ], + env: { + test: { + presets: [ + [ + "@babel/preset-env", + { + targets: "current node", + }, + ], + ], + plugins: [ + [ + "module-resolver", + { + alias: { + styles: "./src/styles", + components: "./src/components", + hooks: "./src/hooks", + utils: "./src/utils", + constants: "./src/constants", + services: "./src/services", + }, + }, + ], + ], + }, + }, + }; +}; diff --git a/babel.config.json b/babel.config.json deleted file mode 100644 index 00432fb5..00000000 --- a/babel.config.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "presets": [ - "@babel/preset-env", - "@babel/preset-react" - ], - "plugins": [ - [ - "@babel/plugin-transform-runtime", - { - "useESModules": true, - "regenerator": false - } - ], - [ - "react-css-modules", - { - "filetypes": { - ".scss": { - "syntax": "postcss-scss" - } - }, - "generateScopedName": "teams_[path][name]___[local]___[hash:base64:6]" - } - ], - "inline-react-svg" - ], - "env": { - "test": { - "presets": [ - [ - "@babel/preset-env", - { - "targets": "current node" - } - ] - ], - "plugins": [ - ["module-resolver", { - "alias": { - "styles": "./src/styles", - "components": "./src/components", - "hooks": "./src/hooks", - "utils": "./src/utils", - "constants": "./src/constants", - "services": "./src/services" - } - }] - ] - } - } -} diff --git a/webpack.config.js b/webpack.config.js index 53bce9e0..5a4d4326 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -4,7 +4,10 @@ const singleSpaDefaults = require("webpack-config-single-spa-react"); const path = require("path"); const autoprefixer = require("autoprefixer"); -const cssLocalIdent = "teams_[path][name]___[local]___[hash:base64:6]"; + +const cssLocalIdent = process.env.APPMODE === "production" + ? "[hash:base64:6]" + : "teams_[path][name]___[local]___[hash:base64:6]"; module.exports = (webpackConfigEnv) => { const defaultConfig = singleSpaDefaults({ From 8b0fe337e3a201323af7f78294e549cfa7430d89 Mon Sep 17 00:00:00 2001 From: maxceem Date: Tue, 19 Jan 2021 14:10:21 +0200 Subject: [PATCH 4/7] chore: config for Visual Studio Code --- .vscode/settings.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..ea4cddfc --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "javascript.preferences.quoteStyle": "double", + "typescript.preferences.quoteStyle": "double", + "prettier.jsxSingleQuote": false +} From 7838bc46e677767b8f132e8a9bd5d91ae65c745d Mon Sep 17 00:00:00 2001 From: maxceem Date: Tue, 19 Jan 2021 14:10:47 +0200 Subject: [PATCH 5/7] chore: exclude moment locales from build --- webpack.config.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/webpack.config.js b/webpack.config.js index 5a4d4326..64dbbbfe 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,4 +1,5 @@ /* global __dirname */ +const webpack = require("webpack"); const webpackMerge = require("webpack-merge"); const singleSpaDefaults = require("webpack-config-single-spa-react"); const path = require("path"); @@ -68,5 +69,10 @@ module.exports = (webpackConfigEnv) => { services: path.resolve(__dirname, "src/services"), }, }, + plugins: [ + // ignore moment locales to reduce bundle size by 64kb gzipped + // see solution details https://stackoverflow.com/questions/25384360/how-to-prevent-moment-js-from-loading-locales-with-webpack/25426019#25426019 + new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), + ], }); }; From a4e09958e5a84824bca9d3ff8cb21e3435138109 Mon Sep 17 00:00:00 2001 From: maxceem Date: Tue, 19 Jan 2021 15:18:15 +0200 Subject: [PATCH 6/7] docs: fix README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aa44f185..4a827f43 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ This is a [single-spa](https://single-spa.js.org/) example React microapp. ## Config -For available variables config which depend on the running environment (`development` or `production`), please refer to `config/development.js` and `config/production.js`. +For available variables config which depend on the running environment (`APPENV=dev` or `APPENV=prod`), please refer to `config/dev.js` and `config/prod.js`. For application constants which don't depend on the running environment use `src/constants/index.js`. From a03b4961451caf27faf0b5e0607b78d70b5eb51f Mon Sep 17 00:00:00 2001 From: yoution Date: Tue, 19 Jan 2021 21:36:30 +0800 Subject: [PATCH 7/7] fix: issue #54 --- src/components/Pagination/styles.module.scss | 7 ++++++- src/components/SkillsList/index.jsx | 1 + src/components/SkillsList/styles.module.scss | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/Pagination/styles.module.scss b/src/components/Pagination/styles.module.scss index 9f0ce714..5c918ff5 100644 --- a/src/components/Pagination/styles.module.scss +++ b/src/components/Pagination/styles.module.scss @@ -2,11 +2,14 @@ .pagination { display: flex; + flex-wrap: wrap; + margin-bottom: -10px; .page { padding: 0 10px; - margin: 0 5px; + margin: 0 5px 10px; min-width: 30px; + } .current { @@ -17,6 +20,7 @@ .next { margin-left: 5px; + margin-bottom: 10px; > svg { transform: rotate(-90deg); @@ -29,6 +33,7 @@ .prev { margin-right: 5px; + margin-bottom: 10px; > svg { margin-right: 3px; diff --git a/src/components/SkillsList/index.jsx b/src/components/SkillsList/index.jsx index edc64219..c4cc1ae4 100644 --- a/src/components/SkillsList/index.jsx +++ b/src/components/SkillsList/index.jsx @@ -101,6 +101,7 @@ const SkillsList = ({ requiredSkills, skills, limit = 3 }) => {
Required Job Skills
    + {!requiredSkills.length &&
  • None
  • } {requiredSkills.map((skill) => (
  • {_.find(skills, { id: skill.id }) ? ( diff --git a/src/components/SkillsList/styles.module.scss b/src/components/SkillsList/styles.module.scss index 637d0967..2b15c443 100644 --- a/src/components/SkillsList/styles.module.scss +++ b/src/components/SkillsList/styles.module.scss @@ -22,10 +22,12 @@ .popover-content { display: flex; - padding: 24px; + flex-wrap: wrap; + padding: 4px 24px 24px; } .skills-section { + margin-top: 20px; padding-right: 32px; }