Skip to content

Create new Notice versions of existing SubtleNotifications #10429

@jimmymadon

Description

@jimmymadon

Feature Description

This issue will focus on creating 5 new <Notice> components which will eventually be replacing similar legacy components in subsequent dependent issues.

Context

<SubtleNotifications> were introduced in the plugin with their "green success" version to replace the larger "Setup success" Banner notification components. However, these notification components eventually had different Warning and Info variants. Some of these variants were created separately and there are multiple versions of each of these components now including some legacy <SettingsNotice> components. The aim of issues 10428 - 10432 and 10484 is to standardise the terminology and component library for all of these old and new similar components to use a newly standardised set defined below.

SuccessNotice
Image

WarningNotice
Image

ErrorNotice
Image

InfoNotice
Image

NewNotice
Image


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

Implementation Brief

  • Add new folder: assets/js/components/Notice and place main re-usable components:
    • DismissButton bare-bone button component, with default label Got it, which can be overridden by a prop, and should accept a callback that is invoked on click. Style it to match tertiary button like Got it from Figma
    • CTAButton also a bare-bone button component, with no default label, same props like previous component. Style it to match primary button like Edit settings from Figma
    • Title - base markup for the notice title
    • Description - base markup for the description
  • Add assets/js/components/Notice/index.js
    • You can use the part of the markup/structure of assets/js/googlesitekit/notifications/components/layout/SubtleNotification.js as an inspiration
    • Use common core class googlesitekit-notice for the wrapper
    • Include props - type, title, description, className, ctaButton and dismissButton, and children.
      • children should render within the container holding the individual CTAs if passed. So we can render custom CTA's, or change their order, etc where applicable instead of pre-defined individual CTA's
      • Individual CTAs should render using the object properties passed as props: ctaButton and dismissButton if they are passed. So for example: ctaButton={{label: '...', clickCallback: functionName}}, etc
      • className can included the list of class names together with the core googlesitekit-notice class.
      • type (one of "success", "warning", "error", "new", "info"), rendered as an extra class (googlesitekit-notice--{type}) and determine the SVG icon.
      • Also include the correct SVG icon based on the type
      • title and description should accept translatable strings as values
      • New Notice component is purely presentational and should not include business logic like dismiss tracking or analytics
    • Add needed styles matching Figma design for each notice type, and core styles in assets/sass/components/notice/_googlesitekit-notice.scss for basic common style

Test Coverage

  • Add assets/js/components/Notice/notice.stories.js which will be used as a catalog to list all notice types
    • See assets/js/util/type-scale.stories.js and assets/js/util/tokens.stories.js for an example
    • You can see the added styles also in storybook/assets/sass/stories/type-scale.scss

QA Brief

  • Test the storybook story, confirm that the variants match the referenced Figma design
    • Note there are extra notices added for each variations, this is mostly to verify all extra elements that can be used are appearing as they should, and also to prevent potential regressions on the styles in the future

Changelog entry

  • Add new components for notices.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Low priorityTeam SIssues for Squad 1Type: EnhancementImprovement of an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions