-
Notifications
You must be signed in to change notification settings - Fork 51
"Interactive" generic component (01) #216
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
"Interactive" generic component (01) #216
Conversation
(it handles button/a/linkto/linktoexternal)
…ive` generic component
|
|
This pull request is being automatically deployed with Vercel (learn more). hds-flight-website – ./🔍 Inspect: https://vercel.com/hashicorp/hds-flight-website/BG258DcyyTwsPk7SrRh9ciDfkVWE hds-components – ./🔍 Inspect: https://vercel.com/hashicorp/hds-components/G1P8XHqM6wFsC1VKGjXhtywiSsw6 |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
it was triggering a lint-error: Do not create empty backing classes for Glimmer components ember/no-empty-glimmer-component-classes
|
@MelSumner as discussed yesterday, I have added the handling of the |
# Conflicts: # packages/components/addon/components/hds/dropdown/list-item.hbs
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.
As far as my understanding of LinkTo and LinkToExternal goes at the moment, this makes sense to me. No suggestions for improvements from my side, I'm afraid.
| </a> | ||
| {{/if}} | ||
| {{else}} | ||
| <button type="button" ...attributes> |
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 like that we set this by default to type="button" to prevent accidental form submissions
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.
Tentative about this one but let's explore how it works!
📌 Summary
While working on the HDS components, me and @MelSumner we've found ourselves writing over and over the same "logic" to handle the different ways to declare a
linkvs aLinkTovs abuttonin Ember (here one of the last examples).This is the TLDR of the "logic" (this is pseudo-code, the actual implementation in code is slightly different)
The intent of this PR is to create a generic, reusable, "utility" component (almost headless) to centralize this logic in a single place, and abstract it away from the actual UI components.
Where it will be used?
At the moment we expect to use it in these components:
buttondropdown/list-item/interactivelink-standalonelink-inline(coming soon)but is likely that most of all the future interactive components/elements will use it as well.
...but wait, why use
@hrefas argument/prop and not justhrefattribute?We can't support the direct use of the
hrefHTML attribute because we need to rely on the@hrefEmber argument to differentiate between different types of generated output (see the "logic" above).🛠️ Detailed description
In this PR I have:
Hds:Interactivecomponent<button>/<a>/<a target="_blank" rel="noopener noreferrer">/<LinkTo>/<LinkToExternal>conditionally, depending on the@href/@route/@isHrefExternal/@isRouteExternalarguments passeddropdown/list-item/interactiveto use the newHds::Interactivegeneric component🤔 Things to decide/discuss
interactive?action? something else?LinkToExternal?👀 How to review
👉 Review by files changed
Reviewer's checklist:
💬 Please consider using conventional comments when reviewing this PR.