-
Notifications
You must be signed in to change notification settings - Fork 104
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 StudioFooter [FC-0062] #463
Changes from all commits
36c5fd8
a996f11
6dce26b
14804ef
c164f37
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import React, { useContext, useState } from 'react'; | ||
import _ from 'lodash'; | ||
import { intlShape, injectIntl, FormattedMessage } from '@edx/frontend-platform/i18n'; | ||
import { useIntl, FormattedMessage } from '@edx/frontend-platform/i18n'; | ||
import { ensureConfig } from '@edx/frontend-platform'; | ||
import { AppContext } from '@edx/frontend-platform/react'; | ||
import { | ||
|
@@ -12,6 +12,9 @@ import { | |
TransitionReplace, | ||
} from '@openedx/paragon'; | ||
import { ExpandLess, ExpandMore, Help } from '@openedx/paragon/icons'; | ||
import classNames from 'classnames'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import messages from './messages'; | ||
|
||
ensureConfig([ | ||
|
@@ -26,12 +29,14 @@ ensureConfig([ | |
], 'Studio Footer component'); | ||
|
||
const StudioFooter = ({ | ||
// injected | ||
intl, | ||
containerProps, | ||
}) => { | ||
const intl = useIntl(); | ||
const [isOpen, setIsOpen] = useState(false); | ||
const { config } = useContext(AppContext); | ||
|
||
const { containerClassName, ...restContainerProps } = containerProps || {}; | ||
|
||
return ( | ||
<> | ||
<div className="m-0 mt-6 row align-items-center justify-content-center"> | ||
|
@@ -49,7 +54,11 @@ const StudioFooter = ({ | |
</Button> | ||
<div className="col border-top ml-2" /> | ||
</div> | ||
<Container size="xl" className="px-4"> | ||
<Container | ||
size="xl" | ||
className={classNames('px-4', containerClassName)} | ||
{...restContainerProps} | ||
> | ||
<TransitionReplace> | ||
{isOpen ? ( | ||
<ActionRow key="help-link-button-row" className="py-4" data-testid="helpButtonRow"> | ||
|
@@ -139,8 +148,11 @@ const StudioFooter = ({ | |
}; | ||
|
||
StudioFooter.propTypes = { | ||
// injected | ||
intl: intlShape.isRequired, | ||
containerProps: PropTypes.shape(Container.propTypes), | ||
}; | ||
|
||
StudioFooter.defaultProps = { | ||
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: a996f11 |
||
containerProps: {}, | ||
}; | ||
|
||
export default injectIntl(StudioFooter); | ||
export default StudioFooter; |
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.
Nice refactor to use hooks vs. the
injectIntl
HOC.