Skip to content

Commit 192adc7

Browse files
committed
feat: expose containerProps in StudioHeader
1 parent 3f4d987 commit 192adc7

File tree

5 files changed

+25
-20
lines changed

5 files changed

+25
-20
lines changed

package-lock.json

+7-15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"@edx/frontend-platform": "8.1.1",
3939
"@edx/reactifex": "^2.1.1",
4040
"@openedx/frontend-build": "14.1.2",
41-
"@openedx/paragon": "22.7.0",
41+
"@openedx/paragon": "22.8.0",
4242
"@testing-library/dom": "10.4.0",
4343
"@testing-library/jest-dom": "5.17.0",
4444
"@testing-library/react": "10.4.9",
@@ -68,7 +68,8 @@
6868
},
6969
"peerDependencies": {
7070
"@edx/frontend-platform": "^7.0.0 || ^8.0.0",
71-
"@openedx/paragon": ">= 21.5.7 < 23.0.0",
71+
"@openedx/paragon": "^22.8.0",
72+
"classnames": "^2.5.1",
7273
"prop-types": "^15.5.10",
7374
"react": "^16.9.0 || ^17.0.0",
7475
"react-dom": "^16.9.0 || ^17.0.0"

src/studio-header/HeaderBody.jsx

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import { useIntl } from '@edx/frontend-platform/i18n';
4+
import classNames from 'classnames';
45
import {
56
ActionRow,
67
Button,
@@ -37,6 +38,7 @@ const HeaderBody = ({
3738
mainMenuDropdowns,
3839
outlineLink,
3940
searchButtonAction,
41+
containerProps,
4042
}) => {
4143
const intl = useIntl();
4244

@@ -50,8 +52,14 @@ const HeaderBody = ({
5052
/>
5153
);
5254

55+
const { className: containerClassName, ...restContainerProps } = containerProps || {};
56+
5357
return (
54-
<Container size="xl" className="px-2.5">
58+
<Container
59+
size="xl"
60+
className={classNames('px-2.5', containerClassName)}
61+
{...restContainerProps}
62+
>
5563
<ActionRow as="header">
5664
{isHiddenMainMenu ? (
5765
<Row className="flex-nowrap ml-4">
@@ -110,6 +118,7 @@ const HeaderBody = ({
110118
iconAs={Icon}
111119
onClick={searchButtonAction}
112120
aria-label={intl.formatMessage(messages['header.label.search.nav'])}
121+
alt={intl.formatMessage(messages['header.label.search.nav'])}
113122
/>
114123
</Nav>
115124
)}
@@ -155,6 +164,7 @@ HeaderBody.propTypes = {
155164
})),
156165
outlineLink: PropTypes.string,
157166
searchButtonAction: PropTypes.func,
167+
containerProps: Container.propTypes,
158168
};
159169

160170
HeaderBody.defaultProps = {

src/studio-header/NavDropdownMenu.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const NavDropdownMenu = ({
3030

3131
NavDropdownMenu.propTypes = {
3232
id: PropTypes.string.isRequired,
33-
buttonTitle: PropTypes.string.isRequired,
33+
buttonTitle: PropTypes.node.isRequired,
3434
items: PropTypes.arrayOf(PropTypes.shape({
3535
href: PropTypes.string,
3636
title: PropTypes.string,

src/studio-header/StudioHeader.jsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ensureConfig([
1616
], 'Studio Header component');
1717

1818
const StudioHeader = ({
19-
number, org, title, isHiddenMainMenu, mainMenuDropdowns, outlineLink, searchButtonAction,
19+
number, org, title, containerProps, isHiddenMainMenu, mainMenuDropdowns, outlineLink, searchButtonAction,
2020
}) => {
2121
const { authenticatedUser, config } = useContext(AppContext);
2222
const props = {
@@ -25,6 +25,7 @@ const StudioHeader = ({
2525
number,
2626
org,
2727
title,
28+
containerProps,
2829
username: authenticatedUser?.username,
2930
isAdmin: authenticatedUser?.administrator,
3031
authenticatedUserAvatar: authenticatedUser?.avatar,
@@ -53,6 +54,7 @@ StudioHeader.propTypes = {
5354
number: PropTypes.string,
5455
org: PropTypes.string,
5556
title: PropTypes.string.isRequired,
57+
containerProps: HeaderBody.propTypes.containerProps,
5658
isHiddenMainMenu: PropTypes.bool,
5759
mainMenuDropdowns: PropTypes.arrayOf(PropTypes.shape({
5860
id: PropTypes.string,

0 commit comments

Comments
 (0)