-
Notifications
You must be signed in to change notification settings - Fork 11
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: New gcds-notice component #627
base: main
Are you sure you want to change the base?
Conversation
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.
Added some comments with changes.
@@ -0,0 +1,35 @@ | |||
# gcds-alert |
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.
Interesting, do you know why this says gcds-alert?
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 copied over the alert files as a base and just missed replacing this one thing 😄
*/ | ||
|
||
/** | ||
* Defines notice role. |
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.
For consistency, could we change this to
* Defines notice role. | |
* Set notice role. |
I've mostly seen us use "Set" here but open to other options
} | ||
|
||
/** | ||
* Defines the notice title. |
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.
Same as above
* Defines the notice title. | |
* Set the notice title. |
<strong class="notice__type"> | ||
{i18n[lang]['type'][type]} | ||
</strong> | ||
{/* Hidden colon to provide pause between caption and heading text for AT */} |
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.
Does AT mean accessibility tree?
{/* Hidden colon to provide pause between caption and heading text for AT */} | |
{/* Hidden colon to provide pause between caption and heading text for accessibility tree */} |
import { newSpecPage } from '@stencil/core/testing'; | ||
import { GcdsNotice } from '../gcds-notice'; | ||
|
||
describe('gcds-alert', () => { |
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.
Maybe a typo? 😄
describe('gcds-alert', () => { | |
describe('gcds-notice', () => { |
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.
Thank you for making all the changes! Looks good to me, I'll hold off on approving until we hear back about the DTO alignment.
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 quickly went through this PR and I would like to propose the following 2 additions:
- Add a property to configure the heading level for the notice. It is not always at level 2.
- Add a property to configure the text representing the type of alert. Sometime a web author might want to use alternate words to represent the type of notice for better integration into existing web content.
Thought?
<Host> | ||
{this.validateRequiredProps() && ( | ||
<section class={`gcds-notice notice--type-${type}`}> | ||
<gcds-heading tag="h2" marginTop="0" class="notice__heading"> |
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.
The use of [tag=h2]
is a good default but there can be some situation where a web author would like to set if for a different heading level.
<section class={`gcds-notice notice--type-${type}`}> | ||
<gcds-heading tag="h2" marginTop="0" class="notice__heading"> | ||
<strong class="notice__type"> | ||
{i18n[lang]['type'][type]} |
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.
What about if the web author want to use alternative words which do also provide a sense of the type of notice?
Take for example an impromptu office closure, IMHO the following notice wont be desirable as there is not necessary means an immediate danger for the public:
Danger: Office closure
The office X was closed for the day due to Y situation.
May be they it will be preferable to have something more contextualized which should be rendered as a danger notice type like:
Unplanned: Office closure
The office X was closed for the day due to Y situation.
I would like to propose to add a new property to allow the web author to customization the text conveying the importance level of the notice. If not provided, it can fallback on this default.
Thought?
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.
Thank you for the input! We have made the decision to change the design of the notice component to back to the design already available from canada.ca (with the icon). We just haven't had a chance to update this PR yet with those design changes
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 have one small suggestion for the code to display the icons. I know we don't have the tokens yet so I'll review again once we have that in place. At the moment I don't see the lines on the icon, I'm guessing we need the tokens for that
name={ | ||
type === 'danger' | ||
? 'exclamation-circle' | ||
: type === 'info' | ||
? 'info-circle' | ||
: type === 'success' | ||
? 'check-circle' | ||
: type === 'warning' | ||
? 'exclamation-triangle' | ||
: null | ||
} |
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.
Could change this to a lookup instead of multiple if-else to optimize it?
Something like:
let iconType = null;
let iconTypes = {
'danger': 'exclamation-circle',
'info': 'info-circle',
'success': 'check-circle',
'warning': 'exclamation-triangle'
}
and then:
name={iconTypes[type]}
@daine Would you be able to test with the tokens package linked? It helps identify if a mistake snuck through in the token package before it is published |
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 | Résumé
The notice is a prominent message to draw attention to important information or change.
Requires tokens from cds-snc/gcds-tokens#330. (Merged and installed)