From ce107bfc04675b5a492b421930b6d8e6838b5f3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B4mulo=20Penido?= Date: Wed, 18 Sep 2024 18:54:02 -0300 Subject: [PATCH 1/6] feat: expose containerProps in StudioHeader --- package-lock.json | 22 +++++++--------------- package.json | 5 +++-- src/studio-header/HeaderBody.jsx | 12 +++++++++++- src/studio-header/NavDropdownMenu.jsx | 2 +- src/studio-header/StudioHeader.jsx | 4 +++- 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index c69c3b834..f32731b5f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,7 @@ "@edx/frontend-platform": "8.1.1", "@edx/reactifex": "^2.1.1", "@openedx/frontend-build": "14.1.2", - "@openedx/paragon": "22.7.0", + "@openedx/paragon": "22.8.0", "@testing-library/dom": "10.4.0", "@testing-library/jest-dom": "5.17.0", "@testing-library/react": "10.4.9", @@ -44,7 +44,8 @@ }, "peerDependencies": { "@edx/frontend-platform": "^7.0.0 || ^8.0.0", - "@openedx/paragon": ">= 21.5.7 < 23.0.0", + "@openedx/paragon": "^22.8.0", + "classnames": "^2.5.1", "prop-types": "^15.5.10", "react": "^16.9.0 || ^17.0.0", "react-dom": "^16.9.0 || ^17.0.0" @@ -3798,18 +3799,10 @@ } }, "node_modules/@openedx/paragon": { - "version": "22.7.0", - "resolved": "https://registry.npmjs.org/@openedx/paragon/-/paragon-22.7.0.tgz", - "integrity": "sha512-BWj4vYXUmLS0BinJckxbhNp0o1UPfwURinaSgTxxBkF0L2VUtAO+SldVWvKDqlltzoR062yjcBA5QSGq8Jxgeg==", + "version": "22.8.0", + "resolved": "https://registry.npmjs.org/@openedx/paragon/-/paragon-22.8.0.tgz", + "integrity": "sha512-WNPLdOOxXwF8h1zBJfCFdUsz6OuuBiVjT6E0Hg9ftq8+qDjION//QOaRm5v13+5bUgjP5/LLGjnIAdD0rwcO8g==", "dev": true, - "license": "Apache-2.0", - "workspaces": [ - "example", - "component-generator", - "www", - "icons", - "dependent-usage-analyzer" - ], "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.1.1", "@fortawesome/react-fontawesome": "^0.1.18", @@ -6876,8 +6869,7 @@ "node_modules/classnames": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz", - "integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==", - "dev": true + "integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==" }, "node_modules/clean-css": { "version": "5.3.3", diff --git a/package.json b/package.json index 522594a5e..83093cf4f 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "@edx/frontend-platform": "8.1.1", "@edx/reactifex": "^2.1.1", "@openedx/frontend-build": "14.1.2", - "@openedx/paragon": "22.7.0", + "@openedx/paragon": "22.8.0", "@testing-library/dom": "10.4.0", "@testing-library/jest-dom": "5.17.0", "@testing-library/react": "10.4.9", @@ -68,7 +68,8 @@ }, "peerDependencies": { "@edx/frontend-platform": "^7.0.0 || ^8.0.0", - "@openedx/paragon": ">= 21.5.7 < 23.0.0", + "@openedx/paragon": "^22.8.0", + "classnames": "^2.5.1", "prop-types": "^15.5.10", "react": "^16.9.0 || ^17.0.0", "react-dom": "^16.9.0 || ^17.0.0" diff --git a/src/studio-header/HeaderBody.jsx b/src/studio-header/HeaderBody.jsx index 7a4426d4b..3f736d38f 100644 --- a/src/studio-header/HeaderBody.jsx +++ b/src/studio-header/HeaderBody.jsx @@ -1,6 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { useIntl } from '@edx/frontend-platform/i18n'; +import classNames from 'classnames'; import { ActionRow, Button, @@ -37,6 +38,7 @@ const HeaderBody = ({ mainMenuDropdowns, outlineLink, searchButtonAction, + containerProps, }) => { const intl = useIntl(); @@ -50,8 +52,14 @@ const HeaderBody = ({ /> ); + const { className: containerClassName, ...restContainerProps } = containerProps || {}; + return ( - + {isHiddenMainMenu ? ( @@ -110,6 +118,7 @@ const HeaderBody = ({ iconAs={Icon} onClick={searchButtonAction} aria-label={intl.formatMessage(messages['header.label.search.nav'])} + alt={intl.formatMessage(messages['header.label.search.nav'])} /> )} @@ -155,6 +164,7 @@ HeaderBody.propTypes = { })), outlineLink: PropTypes.string, searchButtonAction: PropTypes.func, + containerProps: Container.propTypes, }; HeaderBody.defaultProps = { diff --git a/src/studio-header/NavDropdownMenu.jsx b/src/studio-header/NavDropdownMenu.jsx index d8d9dd47a..413755f3c 100644 --- a/src/studio-header/NavDropdownMenu.jsx +++ b/src/studio-header/NavDropdownMenu.jsx @@ -30,7 +30,7 @@ const NavDropdownMenu = ({ NavDropdownMenu.propTypes = { id: PropTypes.string.isRequired, - buttonTitle: PropTypes.string.isRequired, + buttonTitle: PropTypes.node.isRequired, items: PropTypes.arrayOf(PropTypes.shape({ href: PropTypes.string, title: PropTypes.string, diff --git a/src/studio-header/StudioHeader.jsx b/src/studio-header/StudioHeader.jsx index 886ad8411..4d55792ec 100644 --- a/src/studio-header/StudioHeader.jsx +++ b/src/studio-header/StudioHeader.jsx @@ -16,7 +16,7 @@ ensureConfig([ ], 'Studio Header component'); const StudioHeader = ({ - number, org, title, isHiddenMainMenu, mainMenuDropdowns, outlineLink, searchButtonAction, + number, org, title, containerProps, isHiddenMainMenu, mainMenuDropdowns, outlineLink, searchButtonAction, }) => { const { authenticatedUser, config } = useContext(AppContext); const props = { @@ -25,6 +25,7 @@ const StudioHeader = ({ number, org, title, + containerProps, username: authenticatedUser?.username, isAdmin: authenticatedUser?.administrator, authenticatedUserAvatar: authenticatedUser?.avatar, @@ -53,6 +54,7 @@ StudioHeader.propTypes = { number: PropTypes.string, org: PropTypes.string, title: PropTypes.string.isRequired, + containerProps: HeaderBody.propTypes.containerProps, isHiddenMainMenu: PropTypes.bool, mainMenuDropdowns: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string, From e2249b24d5ea8062456256a0d425875046a66800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B4mulo=20Penido?= Date: Thu, 19 Sep 2024 09:48:02 -0300 Subject: [PATCH 2/6] fix: add defaultProps to containerProps --- src/studio-header/HeaderBody.jsx | 3 ++- src/studio-header/StudioHeader.jsx | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/studio-header/HeaderBody.jsx b/src/studio-header/HeaderBody.jsx index 3f736d38f..2afe32426 100644 --- a/src/studio-header/HeaderBody.jsx +++ b/src/studio-header/HeaderBody.jsx @@ -164,7 +164,7 @@ HeaderBody.propTypes = { })), outlineLink: PropTypes.string, searchButtonAction: PropTypes.func, - containerProps: Container.propTypes, + containerProps: PropTypes.shape(Container.propTypes), }; HeaderBody.defaultProps = { @@ -184,6 +184,7 @@ HeaderBody.defaultProps = { mainMenuDropdowns: [], outlineLink: null, searchButtonAction: null, + containerProps: {}, }; export default HeaderBody; diff --git a/src/studio-header/StudioHeader.jsx b/src/studio-header/StudioHeader.jsx index 4d55792ec..adb56973b 100644 --- a/src/studio-header/StudioHeader.jsx +++ b/src/studio-header/StudioHeader.jsx @@ -71,6 +71,7 @@ StudioHeader.propTypes = { StudioHeader.defaultProps = { number: '', org: '', + containerProps: {}, isHiddenMainMenu: false, mainMenuDropdowns: [], outlineLink: null, From 35c2040f2be74f912689f2e4f9e9f63bad242131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B4mulo=20Penido?= Date: Fri, 20 Sep 2024 10:49:47 -0300 Subject: [PATCH 3/6] chore: fix paragon version --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index f32731b5f..12361f62a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,7 @@ "@edx/frontend-platform": "8.1.1", "@edx/reactifex": "^2.1.1", "@openedx/frontend-build": "14.1.2", - "@openedx/paragon": "22.8.0", + "@openedx/paragon": "^22.8.0", "@testing-library/dom": "10.4.0", "@testing-library/jest-dom": "5.17.0", "@testing-library/react": "10.4.9", diff --git a/package.json b/package.json index 83093cf4f..4e682fdb8 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "@edx/frontend-platform": "8.1.1", "@edx/reactifex": "^2.1.1", "@openedx/frontend-build": "14.1.2", - "@openedx/paragon": "22.8.0", + "@openedx/paragon": "^22.8.0", "@testing-library/dom": "10.4.0", "@testing-library/jest-dom": "5.17.0", "@testing-library/react": "10.4.9", From 06bfcc706e719b347c6df7daebc333592c9b68a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B4mulo=20Penido?= Date: Tue, 1 Oct 2024 09:29:23 -0300 Subject: [PATCH 4/6] fix: fix types for Dropdown.Button and Dropdown.Item --- src/studio-header/HeaderBody.jsx | 4 ++-- src/studio-header/MobileHeader.jsx | 4 ++-- src/studio-header/MobileMenu.jsx | 4 ++-- src/studio-header/NavDropdownMenu.jsx | 2 +- src/studio-header/StudioHeader.jsx | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/studio-header/HeaderBody.jsx b/src/studio-header/HeaderBody.jsx index 2afe32426..536dca1e1 100644 --- a/src/studio-header/HeaderBody.jsx +++ b/src/studio-header/HeaderBody.jsx @@ -156,10 +156,10 @@ HeaderBody.propTypes = { isHiddenMainMenu: PropTypes.bool, mainMenuDropdowns: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string, - buttonTitle: PropTypes.string, + buttonTitle: PropTypes.node, items: PropTypes.arrayOf(PropTypes.shape({ href: PropTypes.string, - title: PropTypes.string, + title: PropTypes.node, })), })), outlineLink: PropTypes.string, diff --git a/src/studio-header/MobileHeader.jsx b/src/studio-header/MobileHeader.jsx index f1aecd7f3..fd3cca1bf 100644 --- a/src/studio-header/MobileHeader.jsx +++ b/src/studio-header/MobileHeader.jsx @@ -48,10 +48,10 @@ MobileHeader.propTypes = { isAdmin: PropTypes.bool, mainMenuDropdowns: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string, - buttonTitle: PropTypes.string, + buttonTitle: PropTypes.node, items: PropTypes.arrayOf(PropTypes.shape({ href: PropTypes.string, - title: PropTypes.string, + title: PropTypes.node, })), })), outlineLink: PropTypes.string, diff --git a/src/studio-header/MobileMenu.jsx b/src/studio-header/MobileMenu.jsx index 610321e66..892151cad 100644 --- a/src/studio-header/MobileMenu.jsx +++ b/src/studio-header/MobileMenu.jsx @@ -37,10 +37,10 @@ const MobileMenu = ({ MobileMenu.propTypes = { mainMenuDropdowns: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string, - buttonTitle: PropTypes.string, + buttonTitle: PropTypes.node, items: PropTypes.arrayOf(PropTypes.shape({ href: PropTypes.string, - title: PropTypes.string, + title: PropTypes.node, })), })), }; diff --git a/src/studio-header/NavDropdownMenu.jsx b/src/studio-header/NavDropdownMenu.jsx index 413755f3c..e46c04908 100644 --- a/src/studio-header/NavDropdownMenu.jsx +++ b/src/studio-header/NavDropdownMenu.jsx @@ -33,7 +33,7 @@ NavDropdownMenu.propTypes = { buttonTitle: PropTypes.node.isRequired, items: PropTypes.arrayOf(PropTypes.shape({ href: PropTypes.string, - title: PropTypes.string, + title: PropTypes.node, })).isRequired, }; diff --git a/src/studio-header/StudioHeader.jsx b/src/studio-header/StudioHeader.jsx index adb56973b..0ee6d8539 100644 --- a/src/studio-header/StudioHeader.jsx +++ b/src/studio-header/StudioHeader.jsx @@ -58,10 +58,10 @@ StudioHeader.propTypes = { isHiddenMainMenu: PropTypes.bool, mainMenuDropdowns: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string, - buttonTitle: PropTypes.string, + buttonTitle: PropTypes.node, items: PropTypes.arrayOf(PropTypes.shape({ href: PropTypes.string, - title: PropTypes.string, + title: PropTypes.node, })), })), outlineLink: PropTypes.string, From ccee347905da3fc899dbdfdcb29066f73a1aec8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B4mulo=20Penido?= Date: Tue, 1 Oct 2024 09:40:55 -0300 Subject: [PATCH 5/6] chore: fix paragon version --- package-lock.json | 9 ++++++++- package.json | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6ffed314b..ca8644986 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,7 +45,7 @@ }, "peerDependencies": { "@edx/frontend-platform": "^7.0.0 || ^8.0.0", - "@openedx/paragon": "^22.8.0", + "@openedx/paragon": ">= 21.5.7 < 23.0.0", "classnames": "^2.5.1", "prop-types": "^15.5.10", "react": "^16.9.0 || ^17.0.0", @@ -3410,6 +3410,13 @@ "resolved": "https://registry.npmjs.org/@openedx/paragon/-/paragon-22.8.1.tgz", "integrity": "sha512-lm2x0tvNZrtJvp0L+cjvLLmkE9NoUbNIzt9L1FaOx9g92gf8rFVgq4aadq7IVAjN12HW19/QJMEJaQ0SVsvY2A==", "license": "Apache-2.0", + "workspaces": [ + "example", + "component-generator", + "www", + "icons", + "dependent-usage-analyzer" + ], "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.1.1", "@fortawesome/react-fontawesome": "^0.1.18", diff --git a/package.json b/package.json index 5ab1310ee..bdcaa7c57 100644 --- a/package.json +++ b/package.json @@ -69,8 +69,8 @@ }, "peerDependencies": { "@edx/frontend-platform": "^7.0.0 || ^8.0.0", - "@openedx/paragon": "^22.8.0", "classnames": "^2.5.1", + "@openedx/paragon": ">= 21.5.7 < 23.0.0", "prop-types": "^15.5.10", "react": "^16.9.0 || ^17.0.0", "react-dom": "^16.9.0 || ^17.0.0" From 61243f404b3d1fec44d8849335cc790fc487acc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B4mulo=20Penido?= Date: Tue, 1 Oct 2024 10:11:55 -0300 Subject: [PATCH 6/6] chore: change classnames to dependencies --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index ca8644986..80c9c8121 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "@openedx/frontend-plugin-framework": "^1.3.0", "axios-mock-adapter": "1.22.0", "babel-polyfill": "6.26.0", + "classnames": "^2.5.1", "jest-environment-jsdom": "^29.7.0", "react-responsive": "8.2.0", "react-transition-group": "4.4.5" @@ -46,7 +47,6 @@ "peerDependencies": { "@edx/frontend-platform": "^7.0.0 || ^8.0.0", "@openedx/paragon": ">= 21.5.7 < 23.0.0", - "classnames": "^2.5.1", "prop-types": "^15.5.10", "react": "^16.9.0 || ^17.0.0", "react-dom": "^16.9.0 || ^17.0.0" diff --git a/package.json b/package.json index bdcaa7c57..35eaa9ab2 100644 --- a/package.json +++ b/package.json @@ -63,13 +63,13 @@ "@openedx/frontend-plugin-framework": "^1.3.0", "axios-mock-adapter": "1.22.0", "babel-polyfill": "6.26.0", + "classnames": "^2.5.1", "jest-environment-jsdom": "^29.7.0", "react-responsive": "8.2.0", "react-transition-group": "4.4.5" }, "peerDependencies": { "@edx/frontend-platform": "^7.0.0 || ^8.0.0", - "classnames": "^2.5.1", "@openedx/paragon": ">= 21.5.7 < 23.0.0", "prop-types": "^15.5.10", "react": "^16.9.0 || ^17.0.0",