Skip to content

Hosting Dashboard V2: Add notice component - #103578

Merged
arthur791004 merged 12 commits into
trunkfrom
feat/notice-component
May 27, 2025
Merged

Hosting Dashboard V2: Add notice component#103578
arthur791004 merged 12 commits into
trunkfrom
feat/notice-component

Conversation

@arthur791004

@arthur791004 arthur791004 commented May 21, 2025

Copy link
Copy Markdown
Contributor

Part of DOTCOM-13192

Proposed Changes

  • Add the Notice component for use on the Transfer site.

Variant

Info Warning Success Error
image image image image

Density

Low Medium High
image image image

Others

Not dismissible Without actions
image image

Why are these changes being made?

Testing Instructions

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?
@arthur791004
arthur791004 requested review from a team and youknowriad as code owners May 21, 2025 08:33
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label May 21, 2025
@arthur791004

Copy link
Copy Markdown
Contributor Author

@matt-west I noticed that the warning icon differs from the one used in Gutenberg. Was this intentional? Thank you!

@matticbot

Copy link
Copy Markdown
Contributor

This PR does not affect the size of JS and CSS bundles shipped to the user's browser.

Generated by performance advisor bot at iscalypsofastyet.com.

@youknowriad

Copy link
Copy Markdown
Contributor

Feels like we have too much "Notice" components, we should get some clarity on what to use where and maybe adapt naming.

@jasmussen

Copy link
Copy Markdown
Member

Feels like we have too much "Notice" components, we should get some clarity on what to use where and maybe adapt naming.

This is meant to be a replacement for the Notice component. Not a new separate component.

CC: @fcoveram as you worked on this design.

Copy link
Copy Markdown

Yes. As Joen said, it was thought to replace the current one.

The variants are specs of the same component. The four main variants are voice tones that exist with the content density. You can see how the latter works in the Figma documentation.

@arthur791004

Copy link
Copy Markdown
Contributor Author

You can see how the latter works in the dhW7zYBamXJIeJIE3wy5f4-fi-3765_38524.

Oh nice! I'll update the component based on the Figma spec 🙂

@youknowriad
youknowriad requested review from aduth, ciampo and mirka May 21, 2025 12:11
Comment thread client/dashboard/components/notice/index.tsx Outdated
Comment thread client/dashboard/components/notice/index.stories.tsx Outdated
Comment thread client/dashboard/components/notice/index.stories.tsx Outdated
Comment thread client/dashboard/components/notice/index.stories.tsx Outdated
const hasLowDensity = density === 'low';

return (
<Card

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Given the different notice densities, does it make sense at all to use Card and its subcomponents here vs just a div? Alternatively, should we look into updating Card to offer the same density (padding) options?

cc @jasmussen @fcoveram

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Card already has a size prop which is pretty similar to the density options here. Could/should we use that?

@ciampo ciampo May 21, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We could, but as you noticed, it may not follow the exact specs needed by Notice — that's why I was asking.

@arthur791004 arthur791004 May 22, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, the padding on different Card sizes here doesn't match the padding used in the density option here 🥲

@arthur791004 arthur791004 May 22, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It would be better if we could update the Card, CardHeading, and CardBody components to match the new design (or the styles of the new components), or consider creating a new unified one. Otherwise, we'll need to manually customize padding, font sizes, and other styles each time we implement a new component with a similar structure.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The padding values consider the spacings inside the icon. So the difference is intentional to balance the layout in all density variants. Below you can see a quick test using the values applied in the design, and the ones inherited from Card.

Design paddings

The alignment is slightly off, but general spacings are balanced according to the page layout.

CleanShot 2025-05-22 at 11.55.49@2x.png

Card paddings.

The component's side spacings make it look more prominent.

CleanShot 2025-05-22 at 11.56.17@2x.png

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can't we use the closest Card size then add margin/padding to the internal notice container to make up the difference? So for example if we want 24px padding, use card size small (16px padding) then add 4px padding to the notice container? Having typed that out I guess there's not much value 🙂

I suppose in an ideal world Card size presets would be a bit more expansive than they are currently.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can, probably not much of a difference with overriding Card's styles — the issue would be the same: if Card updates, this component would also need updating to avoid visual regressions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I suppose the long-term solution would be to utilise some semantic spacing tokens from the Theme package.

Comment thread client/dashboard/components/notice/style.scss Outdated

Copy link
Copy Markdown
Contributor

Wasn't the idea to build this as an update to the Notice component in Calypso?

@matt-west

matt-west commented May 21, 2025

Copy link
Copy Markdown
Contributor

@matt-west I noticed that the warning icon differs from the one used in Gutenberg. Was this intentional?

Yes, I think @fcoveram added this in his redesign of the component. I presume to differentiate from the info icon which is very similar visually.

@arthur791004

Copy link
Copy Markdown
Contributor Author

Wasn't the idea to build this as an update to the Notice component in Calypso?

I think it would be better to first consider which component we want to replace and plan how to roll out the replacement later. The original idea was to replace the Notice component in Gutenberg. See #103578 (comment).

@arthur791004
arthur791004 requested a review from a team May 22, 2025 06:16
@jasmussen

Copy link
Copy Markdown
Member

I think it would be better to first consider which component we want to replace and plan how to roll out the replacement later. The original idea was to replace the Notice component in Gutenberg. See #103578 (comment).

Well to clarify: it's all one DS, so even if the ultimate destination is improving the core component directly, for the moment the "upgrade" is being stored in the A8c components package. So to that end, Jay is right. What we want is a single notice: for now that likely has to live in A8c components but with its ultimate destination being WordPress core. What we want to avoid is having multiple components to choose from. Whether that means building this then deprecating the Calypso notice, or just replacing it immediately, I'll leave that to you. But we don't want them both coexisting.

@arthur791004

Copy link
Copy Markdown
Contributor Author

Whether that means building this then deprecating the Calypso notice, or just replacing it immediately, I'll leave that to you. But we don't want them both coexisting.

My suggestion would be to deprecate the old component and adopt the new one for all future notices. We can then progressively replace the existing instances of the Calypso notice, as a complete migration will likely require substantial effort 🙂

@jasmussen

Copy link
Copy Markdown
Member

I'll defer to devs (you and others) on the approach there 👍 👍

@jasmussen

Copy link
Copy Markdown
Member

Here's a quick GIF of the state:

test

At a glance, looks good, will defer to @fcoveram.

@ciampo

ciampo commented May 22, 2025

Copy link
Copy Markdown
Contributor

I'll let the rest of @Automattic/team-calypso confirm, but I believe the approach that we have in mind is:

  • to review the current implementation and move it to @automattic/components (or whenever we decide to host the A8C DS components);
  • to encourage the migration all notices (whether they are a local implementation, or the one from @wordpress/components) to the new implementation.
@arthur791004

Copy link
Copy Markdown
Contributor Author

@Automattic/team-calypso Could you help to review this to see if there is any blocker? Thank you 🙂

@arthur791004
arthur791004 force-pushed the feat/notice-component branch from 01f052b to 42ac58b Compare May 26, 2025 05:54

@taipeicoder taipeicoder left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks mergeable on my end. @tyxla @jsnajdr @mirka let us know if there are additional feedback and we'll follow-up.

@arthur791004

Copy link
Copy Markdown
Contributor Author

We need this component in Site Settings, and I don’t see any blockers at this point, so let’s move it forward and address any feedback in a follow-up PR 🙂

@arthur791004
arthur791004 merged commit 132b4ac into trunk May 27, 2025
@arthur791004
arthur791004 deleted the feat/notice-component branch May 27, 2025 08:21
@github-actions github-actions Bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label May 27, 2025
@ivan-ottinger

Copy link
Copy Markdown
Contributor

Hey folks 👋🏼🙂 Just a quick question: Do you know if there are any near-term plans to get this Notice component into @wordpress/components? We would like to use it in Studio as well to make the UIs consistent, but it would be great if we could import it directly from WordPress components. Thanks!

@mirka

mirka commented Dec 17, 2025

Copy link
Copy Markdown
Member

@ivan-ottinger There's an internal tracking issue at ARC-692. We don't have immediate plans but it will eventually land in the new @wordpress/ui package. Until then, the current Notice component in @wordpress/components will continue to be the standard Core component.

@ivan-ottinger

Copy link
Copy Markdown
Contributor

@ivan-ottinger There's an internal tracking issue at ARC-692. We don't have immediate plans but it will eventually land in the new @wordpress/ui package. Until then, the current Notice component in @wordpress/components will continue to be the standard Core component.

Thanks, @mirka. That's helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet