-
Notifications
You must be signed in to change notification settings - Fork 47
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
"Alert" + "Toast" components - Finalize implementation in code (feature branch) #245
Conversation
Made tweaks along the way: -Change title to required, body optional - Clarify icon is set at 24
Was debugging the failed test
From looking at the other components, we don't want to include <p> (and makes sense with all the globals on <p> e.g. in cloud-ui)
Made tweaks along the way: -Change title to required, body optional - Clarify icon is set at 24
Was debugging the failed test
packages/components/tests/integration/components/hds/alert/index-test.js
Outdated
Show resolved
Hide resolved
packages/components/tests/dummy/app/templates/components/alert.hbs
Outdated
Show resolved
Hide resolved
assert.dom('.flight-icon-alert-diamond').exists(); | ||
}); | ||
|
||
test('if an icon is declared, the icon should render in the component and override the default one', async function (assert) { |
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.
[suggestion] should there be a test here to ensure that the "Default one" renders?
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.
It's the previous test ('it should render an icon by default depending on the type and color'
)
assert.dom('.hds-alert__title').hasText('This is the title'); | ||
assert.dom('.hds-alert__description').hasText('This is the description'); | ||
}); | ||
test('it should render rich HTML when the @description argument contains HTML tags', async function (assert) { |
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.
[comment] I'm surprised that we are even offering this.
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.
[comment] I'm surprised that we are even offering this.
we have multiple of this cases in the audit, we have to support them. and we're (more correctly, we'll be) supporting basic HTML elements like a
, strong
, em
, code
(see CSS and comments)
….hbs Co-authored-by: Melanie Sumner <melanie@hashicorp.com>
Co-authored-by: Christian Veigt <cveigt@gmail.com>
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.
I think this is good enough to ship, let's keep an eye out for how the accessibility shakes out when it's implemented. 👍
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.
LGTM 🚀
📌 Summary
This is the "feature branch" used to finalize the implementation of the
Alert
andToast
components. The implementation of these components has not followed the usual process (for [reasons]) so it's a single large PR for both the components. This PR contains the previous #56 and #91, and the follow-up changes were merged directly in this branch (for development convenience).🛠️ Detailed description
This PR contains these changes.
Alert
Alert
component (HTML/HBS + JS + CSS)Alert
component - page preview hereAlert
componentToast
Toast
component (HBS + CSS) as specializedAlert(inline)
instanceToast
component - page preview hereToast
component👩🔧 Things to know
Alert & Toast
At the beginning there was a single component,
Alert
, that covered all the possible types of notification (Page
,Inline
,Compact
andToast
). Later in the process, it was decided to "extract" theToast
in a distinct component, for many reasons (among them, it was much easier to write documentation, because these two kind of notifications have very different usages, logics, etc).The
Toast
component in Figma is a distinct component, in a distinct page.Similarly in code the
Toast
component is a distinct component, with a distinct documentation page. But under the hood is just using theHds::Alert(Inline)
component (with just a couple of extra styles in CSS).APIs
There have been a few back & forth around the API for the component, in particular around using named blocks and/or contextual components (see for example this discussion: #104).
When we tested the integration of the components in Cloud UI (see below) we run into a few issues around how Ember was treating whitespace and yielded components inside named blocks, see these threads for more details:
You can see a writeup of what we did and what we learned in the process here: #104 (comment)
At the end we decided to get rid of the named blocks, and use only contextual components, to avoid (part of) these problems (and follow the same code pattern used in the dropdown).
Spike for adoption test in Cloud UI
We did a spike to test the integration of the
Hds::Alert
andHds::Test
components in Cloud UI, to reduce as much as possible friction in the adoption phase. You can see the results of this test here: https://github.com/hashicorp/cloud-ui/pull/2429🔗 External links
👀 How to review
👉 Review by files changed (don't even try to go commit by commit :) )
Reviewer's checklist:
💬 Please consider using conventional comments when reviewing this PR.