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

Introduce <Notice> component for WooCommerce Admin #44620

Merged
merged 10 commits into from Feb 20, 2024

Conversation

corsonr
Copy link
Member

@corsonr corsonr commented Feb 14, 2024

Submission Review Guidelines:

Changes proposed in this Pull Request:

This PR is part of the Sale banner project p9h1Lv-bHt-p2

Closes https://github.com/Automattic/woocommerce.com/issues/19573

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. Checkout this branch
  2. Open plugins/woocommerce-admin/client/marketplace/components/content/content.tsx and import the <Notice> component with import Notice from '../notice/notice';
  3. At line 141 add the component with
			<Notice
				id="notice-test"
				variant="info"
				description="This is a <strong>test</strong>."
				icon="info"
				isDismisible
			/>
			<Notice
				id="notice-test-2"
				variant="warning"
				description="This is a test."
				icon="info"
				isDismisible
			/>
			<Notice
				id="notice-test-3"
				variant="success"
				description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse urna magna, cursus eget orci convallis, ullamcorper tincidunt urna. Pellentesque blandit hendrerit risus, in mattis tellus. Nulla faucibus metus rutrum, commodo nunc non, pretium eros. Curabitur libero sapien, accumsan nec ullamcorper eu, rutrum vel odio. Aliquam in nisi augue. Vestibulum sit amet auctor mi. Praesent ligula nisi, dignissim ac nisi vitae, ullamcorper porttitor lacus. Mauris quis lacinia lacus. Sed id magna sed odio rhoncus sagittis ut vitae leo. Aliquam laoreet mollis adipiscing. Vivamus viverra, dui eget fringilla consequat, tellus felis ornare orci, sit amet hendrerit diam nibh et diam. Quisque metus arcu, tristique at ultricies id, venenatis sit amet risus. Fusce et tempus nulla. Aliquam vitae sem quis enim varius auctor lacinia at mi. Nulla facilisi."
				icon="check"
				isDismisible={ false }
			/>
  1. run pnpm build
  2. visit the in-app marketplace page
  3. confirm you see the notices
image
  1. confirm mobile view is working as expected
  2. Close one of the two dismissible notices, and confirm in the Application > Local Storage section of your browser console that an entry is saved for that notice. Refresh the page and confirm the hidden notice doesn't show anymore.
  3. test various combinations of props as per the README file
image

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Comment

@corsonr corsonr self-assigned this Feb 14, 2024
Copy link
Contributor

github-actions bot commented Feb 14, 2024

Hi @lsinger, @mcliwanow,

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

Copy link
Contributor

github-actions bot commented Feb 14, 2024

Test Results Summary

Commit SHA: 7420e78

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 37s
E2E Tests316002403408m 36s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Feb 15, 2024
Regularising the spelling of isDismissible.
Using sanitizeHTML to sanitize the notice description.
Making the variant classes like &-success to make them a bit shorter.
Adjusting wording of README to convey that this component is designed for the marketplace, though it can be used elsewhere.
Tweaking whitespace in one place in the TSX to please the linter.
@corsonr
Copy link
Member Author

corsonr commented Feb 19, 2024

Regularising the spelling of isDismissible.
Using sanitizeHTML to sanitize the notice description.

Good catch @andfinally thanks!

Copy link
Contributor

@andfinally andfinally left a comment

Choose a reason for hiding this comment

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

Looks great, thanks! I just had a few styling suggestions.

The margin between notices should be 32px on mobile.

I'd add a right margin of 12px on .components-button within a notice to keep buttons clear of each other.

I'd suggest we remove the 3px top margin from .woocommerce-marketplace__notice-icon and add align-self: flex-start to .woocommerce-marketplace__notice-close to make sure these elements align with the top of the text when the content is more than one line.

image

The close button looks especially odd centred when there is a lot of content.

image

Copy link
Collaborator

@mcliwanow mcliwanow left a comment

Choose a reason for hiding this comment

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

The component itself looks great 🎉 I left a couple of comments that could improve the code though - things like changing prop types and using CSS class names more consistent with the rest of the codebase.

corsonr and others added 2 commits February 20, 2024 11:31
…/notice.tsx

Co-authored-by: Michal Iwanow <4765119+mcliwanow@users.noreply.github.com>
…ored 40px bottom margin to notices on viewports 600px and above. Added height 24px on icons to ensure they're nicely vertically centred.
Copy link
Contributor

@andfinally andfinally left a comment

Choose a reason for hiding this comment

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

Looks 👌, thanks! I took the liberty of pushing 7420e78 with some small changes, hope that's OK!

  • Using the --{$variant} pattern for the notices classnames also.
  • Added height: 24px; on the icons to ensure they're nicely vertically centred.
  • Restored 40px bottom margin to notices on viewports 600px and above.

@corsonr corsonr requested review from a team and lsinger and removed request for a team February 20, 2024 12:04
@lsinger lsinger removed their request for review February 20, 2024 13:31
@andfinally andfinally merged commit 1cbc044 into trunk Feb 20, 2024
34 checks passed
@andfinally andfinally deleted the add/19573-notice-component branch February 20, 2024 14:52
@github-actions github-actions bot added this to the 8.7.0 milestone Feb 20, 2024
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label Feb 20, 2024
@Stojdza Stojdza added needs: internal testing Indicates if the PR requires further testing conducted by Solaris status: analysis complete Indicates if a PR has been analysed by Solaris and removed needs: analysis Indicates if the PR requires a PR testing scrub session. labels Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: internal testing Indicates if the PR requires further testing conducted by Solaris plugin: woocommerce Issues related to the WooCommerce Core plugin. status: analysis complete Indicates if a PR has been analysed by Solaris
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants