Skip to content

Conversation

@didoo
Copy link
Contributor

@didoo didoo commented Apr 15, 2022

📌 Summary

This is an attempt to solve once for all the issue of "links that look like buttons" in our products.

The previous attempt using a Link::CTA component (see #115) was followed by other issues raised by the developers, this time around the need of a secondary styling for the link (see this Slack thread, but also this Slack thread, this other Slack thread, this Slack thread too, this comment, this Jira ticket, this GitHub PR).

Adding a secondary style for the Link::CTA, which by its own definition is intended to be a design element that [...] stands out from the rest of the page[and] tells the user “this is the most important action on this page” doesn't make sense at this point. The only pragmatic solution is to modify the Button component and allow it to handle links too.

This change will facilitate the migration of the Cloud UI codebase to HDS buttons, unblocking some of the tasks that were in standby, waiting for alternatives to the existing UI implementations based on Structure components.

🛠️ Detailed description

In this PR I have:

  • updated the button to use the new interactive generic component
  • improved assertion guards in button to work differently between buttons and links
  • added special visual treatment to alert the developer if a href HTML attribute is used instead of the @href Ember argument
  • updated documentation page - preview page
    • API
    • showcase
  • updated integration tests

🤔 Things to discuss/decide

  • decide if we want to keep the visual treatment (alert) when the consumer passes a href instead of a @href
    • screenshot_1338

🔗 Links


👀 How to review

👉 Review by files changed

Reviewer's checklist:

  • +1 Percy if applicable

💬 Please consider using conventional comments when reviewing this PR.

@vercel
Copy link

vercel bot commented Apr 15, 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-flight-website – ./

🔍 Inspect: https://vercel.com/hashicorp/hds-flight-website/2qfmBKXqyBrLGJtApKgUE1z9zJ27
✅ Preview: https://hds-flight-website-git-spike-button-with-link-support-hashicorp.vercel.app

hds-components – ./

🔍 Inspect: https://vercel.com/hashicorp/hds-components/ByKn5di8B7B9F9BY4VKatEEWwtSi
✅ Preview: https://hds-components-git-spike-button-with-link-support-hashicorp.vercel.app

@changeset-bot
Copy link

changeset-bot bot commented Apr 15, 2022

⚠️ No Changeset found

Latest commit: dff380e

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

@didoo didoo changed the title [WIP] Extend the "Button" component to support also links as actions [WIP] Extend the "Button" component to support also links as actions (02) Apr 15, 2022
@vercel
Copy link

vercel bot commented Apr 19, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
hds-components ✅ Ready (Inspect) Visit Preview May 19, 2022 at 10:55AM (UTC)
hds-flight-website ✅ Ready (Inspect) Visit Preview May 19, 2022 at 10:55AM (UTC)

@vercel vercel bot temporarily deployed to Preview – hds-flight-website April 19, 2022 13:39 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components April 19, 2022 13:39 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-flight-website April 19, 2022 13:42 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components April 19, 2022 13:42 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-flight-website April 20, 2022 12:22 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components April 20, 2022 12:22 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components April 20, 2022 12:46 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-flight-website April 20, 2022 12:46 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-flight-website April 20, 2022 12:50 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components April 20, 2022 12:51 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-flight-website April 20, 2022 13:21 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components April 20, 2022 13:21 Inactive
@didoo didoo force-pushed the spike-button-with-link-support branch from d41acff to abd2aac Compare April 20, 2022 13:29
@vercel vercel bot temporarily deployed to Preview – hds-flight-website April 20, 2022 13:30 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components April 20, 2022 13:30 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-flight-website April 20, 2022 14:12 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components April 20, 2022 14:12 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-flight-website May 18, 2022 16:26 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components May 18, 2022 16:44 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-flight-website May 18, 2022 16:46 Inactive
}
}

/**
Copy link
Contributor Author

@didoo didoo May 18, 2022

Choose a reason for hiding this comment

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

I've removed the @type argument from the API in favour of the type native attribute (this simplifies the code)

Notice: by default type="button" (see Hds::Interactive code)


// SPECIAL

// we apply a visual treatment to alert the developer if a "href" HTML attribute is used (instead of the "@href" Ember argument)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

please let me know what you think of this

Copy link
Member

Choose a reason for hiding this comment

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

seems like a good idea; if we end-up needing this in other places there may be value in converting it into a mixin

@vercel vercel bot temporarily deployed to Preview – hds-flight-website May 18, 2022 16:56 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components May 18, 2022 16:56 Inactive
Copy link
Contributor

@MelSumner MelSumner left a comment

Choose a reason for hiding this comment

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

Reiterating in writing that we need to plan future work to improve this, as it's not an ideal outcome to have a component that renders something different to the browser than the name suggests. We have some constraints here and need to do some additional planning, but want to iterate on this for an improved outcome.

@vercel vercel bot temporarily deployed to Preview – hds-components May 18, 2022 17:45 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-flight-website May 18, 2022 17:45 Inactive
Copy link
Member

@alex-ju alex-ju left a comment

Choose a reason for hiding this comment

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

The Interactive abstraction makes sense to me; code looks good.


// SPECIAL

// we apply a visual treatment to alert the developer if a "href" HTML attribute is used (instead of the "@href" Ember argument)
Copy link
Member

Choose a reason for hiding this comment

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

seems like a good idea; if we end-up needing this in other places there may be value in converting it into a mixin

@vercel vercel bot temporarily deployed to Preview – hds-flight-website May 19, 2022 10:49 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components May 19, 2022 10:50 Inactive
Remove the "Link/LinkTo::CTA" component (03)
@vercel vercel bot temporarily deployed to Preview – hds-flight-website May 19, 2022 10:55 Inactive
@vercel vercel bot temporarily deployed to Preview – hds-components May 19, 2022 10:55 Inactive
@didoo didoo merged commit fa79875 into spike-BUTTON-LINK-CTA-main May 19, 2022
@didoo didoo deleted the spike-button-with-link-support branch May 19, 2022 10:59
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.

3 participants