Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.10.0 #77

Merged
merged 5 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.git
node_modules
build
test-coverage
reference

.DS_Store
14 changes: 14 additions & 0 deletions build.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:22.5-alpine

EXPOSE 3000
EXPOSE 3010

WORKDIR /app
COPY . ./build-temp

WORKDIR /app/build-temp
RUN npm ci

WORKDIR /app
RUN mv ./build-temp/node_modules ./
RUN rm -rf ./build-temp
1 change: 0 additions & 1 deletion index.js

This file was deleted.

8 changes: 6 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ module.exports = {
moduleNameMapper: {
'@stomp/stompjs': '<rootDir>/src/__mocks__/fileMock.js',
'@stomp/rx-stomp': '<rootDir>/src/__mocks__/fileMock.js',
'(pdfjs-dist/legacy/build/pdf.worker)': '<rootDir>/src/__mocks__/constructorMock.js',
'(pdfjs-dist/build/pdf.worker.mjs)': '<rootDir>/src/__mocks__/constructorMock.js',
'\\.(css|less)$': '<rootDir>/src/__mocks__/styleMock.js',
'\\.(svg)$': '<rootDir>/src/__mocks__/svgMock.js',
'react-markdown': '<rootDir>/node_modules/react-markdown/react-markdown.min.js',
'react-markdown': [
'<rootDir>/node_modules/react-markdown/react-markdown.min.js',
'<rootDir>/../node_modules/react-markdown/react-markdown.min.js',
],
},
transform: {
'\\.(js|jsx|ts|tsx)$': 'babel-jest',
Expand All @@ -21,6 +24,7 @@ module.exports = {
transformIgnorePatterns: [
"node_modules/(?!(dateformat|remark-gfm|micromark-.+|decode-named-character-reference|character-entities|mdast-.*|escape-string-regexp|unist-util-.*|markdown-.*|ccount|d3-[a-z]+)/)",
],
globalSetup: '<rootDir>/scripts/jest-global-setup.js',
setupFiles: [
'jest-canvas-mock',
],
Expand Down
3 changes: 3 additions & 0 deletions lib/components/NeonPage/NeonPage.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ declare namespace NeonPage {
export const progress: PropTypes.Requireable<number>;
export const resetStateAfterRuntimeError: PropTypes.Requireable<(...args: any[]) => any>;
export { children as sidebarContent };
export const sidebarContentResponsive: PropTypes.Requireable<boolean>;
export const sidebarContainerClassName: PropTypes.Requireable<string>;
export const sidebarLinks: PropTypes.Requireable<(PropTypes.InferProps<{
name: PropTypes.Validator<string>;
Expand Down Expand Up @@ -83,6 +84,8 @@ declare namespace NeonPage {
export function resetStateAfterRuntimeError_1(): void;
export { resetStateAfterRuntimeError_1 as resetStateAfterRuntimeError };
export const sidebarContent: null;
const sidebarContentResponsive_1: boolean;
export { sidebarContentResponsive_1 as sidebarContentResponsive };
const sidebarContainerClassName_1: null;
export { sidebarContainerClassName_1 as sidebarContainerClassName };
const sidebarLinks_1: null;
Expand Down
27 changes: 26 additions & 1 deletion lib/components/NeonPage/NeonPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ const NeonPage = props => {
progress,
resetStateAfterRuntimeError,
sidebarContent,
sidebarContentResponsive,
sidebarContainerClassName: sidebarContainerClassNameProp,
sidebarLinks,
sidebarLinksAdditionalContent,
Expand Down Expand Up @@ -685,7 +686,7 @@ const NeonPage = props => {
} : {};
const sidebarClassName = sidebarContainerClassNameProp ? "".concat(classes.sidebarContainer, " ").concat(sidebarContainerClassNameProp) : classes.sidebarContainer;
// Arbitrary Content Sidebar (no automatic skeleton)
if (hasSidebarContent) {
if (hasSidebarContent && !sidebarContentResponsive) {
return /*#__PURE__*/_react.default.createElement("div", {
ref: sidebarRef,
className: sidebarClassName,
Expand Down Expand Up @@ -721,6 +722,28 @@ const NeonPage = props => {
className: classes.sidebarSubtitle
}, sidebarSubtitle)));
};
// Arbitrary Content Sidebar (no automatic skeleton)
if (hasSidebarContent) {
return /*#__PURE__*/_react.default.createElement("div", {
ref: sidebarRef,
className: sidebarClassName,
style: sidebarContainerStyle
}, /*#__PURE__*/_react.default.createElement("div", {
className: !sidebarUnsticky && !belowMd ? "".concat(classes.sidebarInnerStickyContainer, " neon__sidebar-sticky") : null
}, /*#__PURE__*/_react.default.createElement("div", {
className: classes.sidebarTitleContainer
}, renderSidebarTitle(), !belowMd ? null : /*#__PURE__*/_react.default.createElement(_IconButton.default, {
size: "small",
onClick: () => setSidebarExpanded(!sidebarExpanded)
}, sidebarExpanded ? /*#__PURE__*/_react.default.createElement(_ExpandLess.default, {
fontSize: "large"
}) : /*#__PURE__*/_react.default.createElement(_ExpandMore.default, {
fontSize: "large"
}))), !belowMd || sidebarExpanded ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Divider.default, {
className: classes.sidebarDivider,
style: _extends({}, dividerStyle)
}), sidebarContent) : null));
}
// Render Single Sidebar Link
const renderLink = function (link) {
let standalone = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
Expand Down Expand Up @@ -861,6 +884,7 @@ NeonPage.propTypes = {
progress: _propTypes.default.number,
resetStateAfterRuntimeError: _propTypes.default.func,
sidebarContent: children,
sidebarContentResponsive: _propTypes.default.bool,
sidebarContainerClassName: _propTypes.default.string,
sidebarLinks: _propTypes.default.arrayOf(_propTypes.default.shape({
name: _propTypes.default.string.isRequired,
Expand Down Expand Up @@ -895,6 +919,7 @@ NeonPage.defaultProps = {
progress: null,
resetStateAfterRuntimeError: () => {},
sidebarContent: null,
sidebarContentResponsive: false,
sidebarContainerClassName: null,
sidebarLinks: null,
sidebarLinksAdditionalContent: null,
Expand Down
48 changes: 24 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 18 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "portal-core-components",
"version": "2.9.2",
"version": "2.10.0",
"main": "./lib/index.js",
"private": true,
"homepage": "http://localhost:3010/core-components",
Expand Down Expand Up @@ -73,7 +73,7 @@
"cssnano": "^7.0.4",
"jsdom": "^24.1.1",
"node-fetch": "^3.3.2",
"postcss": "^8.4.39",
"postcss": "^8.4.40",
"prettier": "^3.3.3",
"worker-loader": "^3.0.8"
},
Expand Down Expand Up @@ -112,7 +112,7 @@
"@babel/preset-typescript": "^7.24.7",
"@jest/globals": "^29.7.0",
"@testing-library/react-hooks": "^8.0.1",
"@typescript-eslint/parser": "^7.16.1",
"@typescript-eslint/parser": "^7.17.0",
"commander": "^12.1.0",
"cssnano": "^7.0.4",
"eslint": "^8.57.0",
Expand All @@ -121,11 +121,11 @@
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-react": "^7.35.0",
"express": "^4.19.2",
"html-loader": "^5.0.0",
"html-loader": "^5.1.0",
"jest-canvas-mock": "^2.5.2",
"jsdom": "^24.1.1",
"node-fetch": "^3.3.2",
"postcss": "^8.4.39",
"postcss": "^8.4.40",
"prettier": "^3.3.3",
"react-scripts": "^5.0.1",
"react-test-renderer": "^17.0.2",
Expand All @@ -151,7 +151,19 @@
"lib:post-clean-styleGuides": "rm ./lib/components/**/StyleGuide.*",
"lib:post-clean-img": "rm -r ./lib/components/SiteMap/png && rm -r ./lib/components/SiteMap/svg_source && rm -r ./lib/components/DataThemeIcon/svg_source",
"lib:post-clean-tests": "rm -r ./lib/*/__tests__ && rm -r ./lib/*/*/__tests__",
"checks": "npm run lint && npm run test && npm run lib && npm run build"
"checks": "npm run lib && npm run lint && npm run test && npm run build",
"checks:docker": "npm run build:docker-image && npm run lib:docker && npm run test:docker && npm run build:docker",
"start:docker": "docker run --rm --tty --interactive --volume=/$(pwd):/app/src --volume=/app/src/node_modules --workdir=/app/src --publish=3010:3010 portal-core-components:latest-builder npm run start",
"start:docker-prod": "docker run --rm --tty --interactive --volume=/$(pwd):/app/src --volume=/app/src/node_modules --workdir=/app/src --publish=3000:3000 portal-core-components:latest-builder npm run start:prod",
"build:docker-clean": "docker image rm portal-core-components:latest-builder",
"build:docker-build-image": "docker buildx build --no-cache --tag portal-core-components:latest-builder --file ./build.Dockerfile .",
"build:docker-image": "(npm run build:docker-clean || true) && npm run build:docker-build-image",
"build:docker": "docker run --rm --tty --interactive --env GENERATE_SOURCEMAP=false --env NODE_OPTIONS=--max_old_space_size=4096 --volume=/$(pwd):/app/src --volume=/app/src/node_modules --workdir=/app/src portal-core-components:latest-builder npm run build",
"lib:docker": "docker run --rm --tty --interactive --volume=/$(pwd):/app/src --volume=/app/src/node_modules --workdir=/app/src portal-core-components:latest-builder npm run lib",
"test:docker": "docker run --rm --tty --interactive --volume=/$(pwd):/app/src --volume=/app/src/node_modules --workdir=/app/src portal-core-components:latest-builder npm run test:docker-command",
"test:docker-update-snapshots": "docker run --rm --tty --interactive --volume=/$(pwd):/app/src --volume=/app/src/node_modules --workdir=/app/src portal-core-components:latest-builder npm run test:docker-command-update-snapshots",
"test:docker-command": "npm run lint && npm run test",
"test:docker-command-update-snapshots": "npm run lint && npm run test:updateSnapshots"
},
"browserslist": {
"production": [
Expand Down
5 changes: 5 additions & 0 deletions scripts/jest-global-setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const jestGlobalSetup = async () => {
process.env.TZ = 'UTC';
};

export default jestGlobalSetup;
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ exports[`DownloadStepForm Step summary renders correctly 1`] = `
<span
className="MuiChip-label"
>
3 sites — Dec 2019 - Dec 2019
3 sites — Jan 2020 - Jan 2020
</span>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ exports[`NeonAuth - UserCard Renders with a lastLogin prop 1`] = `
<label
className="label-normal"
>
May 4th, 2018 6:00:00 pm
May 5th, 2018 12:00:00 am
</label>
</div>
</div>
Expand Down
Loading