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

Alert (Page) and Alert (Inline) #124

Merged
merged 31 commits into from
Mar 30, 2022
Merged

Conversation

amyrlam
Copy link
Contributor

@amyrlam amyrlam commented Mar 26, 2022

📌 Summary

Add Alert Page implementation (right now as the base Alert) with styling

📸 Screenshots

See https://hds-components-git-amy-alert-page-hashicorp.vercel.app/components/alert

🔗 External links

https://app.asana.com/0/1201630204387510/1201994286157139/f


👀 How to review

👉 Review by files changed

Reviewer's checklist:

  • +1 Percy if applicable
  • [N/A, merging into another branch] Confirm that PR has a changelog update via Changesets if needed

💬 Please consider using conventional comments when reviewing this PR.


@vercel
Copy link

vercel bot commented Mar 26, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

hds-components – ./

🔍 Inspect: https://vercel.com/hashicorp/hds-components/8Ra9anNWnPASWrTJWrL4qtXKnYMS
✅ Preview: https://hds-components-git-amy-alert-page-hashicorp.vercel.app

hds-flight-website – ./

🔍 Inspect: https://vercel.com/hashicorp/hds-flight-website/2BezfVQMtMcBtJqDe5xP4wjh23u3
✅ Preview: https://hds-flight-website-git-amy-alert-page-hashicorp.vercel.app

@changeset-bot
Copy link

changeset-bot bot commented Mar 26, 2022

⚠️ No Changeset found

Latest commit: e01372d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel vercel bot temporarily deployed to Preview – hds-flight-website March 26, 2022 00:12 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components March 26, 2022 00:12 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-flight-website March 26, 2022 00:14 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components March 26, 2022 00:14 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-flight-website March 26, 2022 00:19 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components March 26, 2022 00:19 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-flight-website March 26, 2022 00:57 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components March 26, 2022 00:57 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-flight-website March 26, 2022 01:55 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components March 26, 2022 01:55 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-flight-website March 26, 2022 01:57 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components March 26, 2022 01:57 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-flight-website March 26, 2022 02:04 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components March 26, 2022 02:04 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components March 26, 2022 02:20 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-flight-website March 26, 2022 02:20 Inactive
@amyrlam amyrlam changed the title Add Base alert (to become Alert::Page) Alert (Page) and Alert (Inline) Mar 29, 2022
@amyrlam
Copy link
Contributor Author

amyrlam commented Mar 29, 2022

@didoo @cveigt ready for another look, please LMK what you think: https://hds-components-git-amy-alert-page-hashicorp.vercel.app/components/alert

If you have code changes, feel free to suggest, commit to the branch, or make a new branch, whatever is easiest for you

I was thinking we could sync later this week once Alert (Compact), isDismissible, and some light testing in cloud-ui is done. I'll set it up, I made a ticket for me to set that up

Copy link
Contributor

@didoo didoo left a comment

Choose a reason for hiding this comment

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

@amyrlam in general the code is OK for me, I have left only a few comments.
don't know if you want to already merge this (in which case let me know and I'll approve) and continue to work in a new branch, or instead continue directly on this

'highlight',
'success',
];
export const MAPPING_COLORS_TO_ICONS = {
Copy link
Contributor

@didoo didoo Mar 29, 2022

Choose a reason for hiding this comment

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

@amyrlam notice: for now this works perfectly, but I've just realized that these icons can be filled or not depending if they are in the "compact" alert or not, so it's likely we'll have to move this mapping logic inside the get icon() method directly, and use the @type/this.type as an extra condition to determine which icon to use

@amyrlam @Dhaulagiri @MelSumner can you see now the power of moving the logic in the "right" place? can you imagine doing all these conditionals only at template level?

see how it was before

{{#if (or @icon @color)}}
<div class="hds-alert__icon">
{{#if @icon}}
<FlightIcon @name={{@icon}} @size="24" @isInlineBlock={{false}} />
{{else if (or (eq @color "neutral") (eq @color "highlight"))}}
<FlightIcon @name="info" @size="24" @isInlineBlock={{false}} />
{{else if (eq @color "success")}}
<FlightIcon @name="check-circle" @size="24" @isInlineBlock={{false}} />
{{else if (eq @color "warning")}}
<FlightIcon @name="alert-triangle" @size="24" @isInlineBlock={{false}} />
{{else if (eq @color "critical")}}
<FlightIcon @name="alert-octagon" @size="24" @isInlineBlock={{false}} />
{{/if}}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We talked about ^^ in a meeting, I'll address the compact type shortly. I get what you're saying now. Compact type has a different mapping of which default icon it informs. It will have some .hbs logic as well, as certain elements will be hidden, but can discuss when up soon

Co-authored-by: Cristiano Rastelli <cristiano.rastelli@hashicorp.com>
@vercel vercel bot temporarily deployed to Preview – hds-flight-website March 29, 2022 15:26 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components March 29, 2022 15:26 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components March 29, 2022 15:28 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-flight-website March 29, 2022 15:28 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components March 29, 2022 15:43 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-flight-website March 29, 2022 15:43 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components March 30, 2022 05:30 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-flight-website March 30, 2022 05:30 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-flight-website March 30, 2022 05:33 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components March 30, 2022 05:33 Inactive
@amyrlam
Copy link
Contributor Author

amyrlam commented Mar 30, 2022

@didoo let's merge this in to limit unnecessary branching? also for ease of code review

  • please +1 code and percy, and feel free to merge it in
  • or if you have other edits, feel free to make them to the branch directly and merge as not going to main?

@vercel vercel bot temporarily deployed to Preview – hds-flight-website March 30, 2022 06:01 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components March 30, 2022 06:01 Inactive
Copy link
Contributor

@didoo didoo left a comment

Choose a reason for hiding this comment

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

As suggested by @amyrlam merging this in to limit unnecessary branching

@didoo didoo merged commit 920f7e3 into amy/alert-overall-branch Mar 30, 2022
@didoo didoo deleted the amy/alert-page branch March 30, 2022 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants