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

feat(content-explorer-modal-container): add optional info notice #3634

Conversation

psatala-box
Copy link
Contributor

@psatala-box psatala-box commented Sep 5, 2024

Screenshot 2024-09-06 at 11 50 44

This PR adds an optional informational notice into the Content Explorer Modal Container. By default the notice is not shown. The notice text is passed in infoNoticeText. The text passed may not be empty for the notice to be shown.

@psatala-box psatala-box requested a review from a team as a code owner September 5, 2024 16:18
@CLAassistant
Copy link

CLAassistant commented Sep 5, 2024

CLA assistant check
All committers have signed the CLA.

@psatala-box psatala-box force-pushed the add-info-notice-to-content-explorer-modal-container branch from 8399665 to 0e54865 Compare September 5, 2024 16:20
@@ -552,6 +559,7 @@ class ContentExplorer extends Component {
}}
{...contentExplorerProps}
>
{isInfoNoticeVisible && <ContentExplorerInfoNotice infoNoticeText={infoNoticeText} />}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use one prop to control this instead of two:

Suggested change
{isInfoNoticeVisible && <ContentExplorerInfoNotice infoNoticeText={infoNoticeText} />}
{infoNoticeText && <ContentExplorerInfoNotice infoNoticeText={infoNoticeText} />}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

import InlineNotice from '../../../components/inline-notice';

const ContentExplorerInfoNotice = ({ infoNoticeText }) => (
<InlineNotice type="info" className="content-explorer-info-notice">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this use the InlineNotice from blueprint?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, updated. Now the whole implementation is simpler

import ContentExplorerInfoNotice from '../ContentExplorerInfoNotice';

describe('features/content-explorer/content-explorer/ContentExplorerInfoNotice', () => {
const renderComponent = infoNoticeText => shallow(<ContentExplorerInfoNotice infoNoticeText={infoNoticeText} />);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new tests should use react testing library

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@psatala-box psatala-box force-pushed the add-info-notice-to-content-explorer-modal-container branch from 97668e2 to 5f31508 Compare September 6, 2024 09:02
Copy link
Contributor

@michalkowalczyk-box michalkowalczyk-box left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@@ -0,0 +1,25 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import { injectIntl } from 'react-intl';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we've been moving towards useIntl now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

<InlineNotice
variant="info"
variantIconAriaLabel={intl.formatMessage(messages.infoNoticeIconAriaLabel)}
className="content-explorer-info-notice"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need this class anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we've been writing new files in tsx

although maybe you can write this inline of ContentExplorer since it doesn't need to be a separate component?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the files to .tsx. I tried inlining it, but came across some issues with injecting i18n in tests, so I decided to simply update to .tsx

@psatala-box psatala-box force-pushed the add-info-notice-to-content-explorer-modal-container branch from ec77f18 to 6b386e8 Compare September 9, 2024 11:53
@mergify mergify bot merged commit 20d4c3f into box:master Sep 12, 2024
6 checks passed
@psatala-box psatala-box deleted the add-info-notice-to-content-explorer-modal-container branch September 12, 2024 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants