-
Notifications
You must be signed in to change notification settings - Fork 124
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
feat: expose containerProps in StudioHeader [FC-0062] #529
Changes from 1 commit
ce107bf
e2249b2
35c2040
d7c69a2
10c3e12
89c949d
06bfcc7
ccee347
61243f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is dropping the previously supported range intentional? As is, this is a breaking change since it drops support for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was intentional as it was built on top of Paragon But I still think we should update the version here, and I can't see how this could impact someone, as the current frontend-component-header/package-lock.json Lines 3407 to 3408 in e44001e
Could you help me to understand? Thank you! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, I'm not sure if we should have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The The ❯ npm list --omit=dev --depth=0
@edx/[email protected] /Users/astankiewicz/Desktop/edx/frontend-component-header
├── @fortawesome/[email protected]
├── @fortawesome/[email protected]
├── @fortawesome/[email protected]
├── @fortawesome/[email protected]
├── @fortawesome/[email protected]
├── @openedx/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
❯ npm list --include=dev --depth=0
@edx/[email protected] /Users/astankiewicz/Desktop/edx/frontend-component-header
├── @edx/brand@npm:@openedx/[email protected]
├── @edx/[email protected]
├── @edx/[email protected]
├── @edx/[email protected]
├── @fortawesome/[email protected]
├── @fortawesome/[email protected]
├── @fortawesome/[email protected]
├── @fortawesome/[email protected]
├── @fortawesome/[email protected]
├── @openedx/[email protected]
├── @openedx/[email protected]
├── @openedx/[email protected]
├── @testing-library/[email protected]
├── @testing-library/[email protected]
├── @testing-library/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now I got it! Thank you for the explanation! |
||||||
"classnames": "^2.5.1", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe we may want to make this a regular dependency under
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the explanation! Fixed here: 61243f4 |
||||||
"prop-types": "^15.5.10", | ||||||
"react": "^16.9.0 || ^17.0.0", | ||||||
"react-dom": "^16.9.0 || ^17.0.0" | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<Container size="xl" className="px-2.5"> | ||
<Container | ||
size="xl" | ||
className={classNames('px-2.5', containerClassName)} | ||
{...restContainerProps} | ||
> | ||
<ActionRow as="header"> | ||
{isHiddenMainMenu ? ( | ||
<Row className="flex-nowrap ml-4"> | ||
|
@@ -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'])} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not related to this feature. This is a fly-by fix of a console warning. Let me know if I should create a different PR for this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for fixing these! Fewer warnings is always good. |
||
/> | ||
</Nav> | ||
)} | ||
|
@@ -155,6 +164,7 @@ HeaderBody.propTypes = { | |
})), | ||
outlineLink: PropTypes.string, | ||
searchButtonAction: PropTypes.func, | ||
containerProps: Container.propTypes, | ||
}; | ||
|
||
HeaderBody.defaultProps = { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ const NavDropdownMenu = ({ | |
|
||
NavDropdownMenu.propTypes = { | ||
id: PropTypes.string.isRequired, | ||
buttonTitle: PropTypes.string.isRequired, | ||
buttonTitle: PropTypes.node.isRequired, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not related to this feature. This is a fly-by fix of a console warning. Let me know if I should create a different PR for this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed other places here: 06bfcc7 |
||
items: PropTypes.arrayOf(PropTypes.shape({ | ||
href: PropTypes.string, | ||
title: PropTypes.string, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed here: e2249b2 |
||
isHiddenMainMenu: PropTypes.bool, | ||
mainMenuDropdowns: PropTypes.arrayOf(PropTypes.shape({ | ||
id: PropTypes.string, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this mirror StudioFooter's dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch @pomegranited!
The version was wrong in both!
We need paragon 22.8.0 or upper here, so it should be
^22.8.0
. We don't need the< 23.0.0
part because the^
would not allow updates to major versions.Fixed here: 35c2040