Skip to content

Commit

Permalink
Replace <StandaloneLink /> with anchor element in `<RelatedContent …
Browse files Browse the repository at this point in the history
…/>` (#845)

🎟️ [Asana Task]()
🔍 [Preview Link](https://react-components-git-{branch-slug}-hashicorp.vercel.app)

---

<!-- Reminder: This is an open source project, make sure not to include any sensitive information in the pull request. -->

## Description
When `<RelatedContent />` was created, it used the `<StandaloneLink />` component for a CTA. However, the WPL spec for `<RelatedContent />` does not utilize `<StandaloneLink />` and instead uses its own, custom link.

This PR removes the `<StandaloneLink />` and adds an `anchor` element.


## Validation Steps
- Navigate to [the preview
](https://react-components-git-naupdate-relatedcontent-hashicorp.vercel.app/components/relatedcontent)
- Verify that the CTA link matches the spec for light and dark:

<img width="169" alt="Screen Shot 2022-12-09 at 11 33 52 AM" src="https://user-images.githubusercontent.com/39201593/206782866-d62702d8-a1c4-441d-9bcc-29deb271aa93.png">
<img width="163" alt="Screen Shot 2022-12-09 at 11 33 55 AM" src="https://user-images.githubusercontent.com/39201593/206782871-c8959d7b-2dcb-4e71-b475-cc30a17f0105.png">


### PR Checklist 🚀

Items in this checklist may not may not apply to your PR, but please consider each item carefully.

- [ ] Add Asana and Preview links above.
- [ ] Conduct thorough self-review.
- [ ] Add or update tests as appropriate.
- [ ] Conduct reasonable cross browser testing for both compatibility and responsive behavior (We have a [Sauce Labs](https://app.saucelabs.com/) account for this, if you don't have access, just ask!).
- [ ] Conduct reasonable accessibility review (use the [WAS](https://accessible.org/Web-Accessibility-Standards-WAS-2.pdf) as a guide or an [axe browser plugin](https://www.deque.com/axe/) until we establish more formal checks).
- [ ] Identify (in the description above) and document (add Asana tasks on [this board](https://app.asana.com/0/1100423001970639/list)) any technical debt that you're aware of, but are not addressing as part of this PR.
  • Loading branch information
nandereck committed Dec 13, 2022
1 parent c543e1c commit 4734c65
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/three-ravens-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hashicorp/react-related-content': minor
---

Replace StandaloneLink with custom link
2 changes: 1 addition & 1 deletion packages/related-content/docs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ A full-page-width component that displays text and cards. Used for displaying re
]
}
cta={{
text: "Sign up now",
text: "View all resources",
href: "/components/relatedcontent"
}}
/>
Expand Down
10 changes: 5 additions & 5 deletions packages/related-content/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { RelatedContentProps } from './types'
import classNames from 'classnames'
import Card from '@hashicorp/react-card'
import StandaloneLink from '@hashicorp/react-standalone-link'
import classNames from 'classnames'
import Link from 'next/link'
import type { RelatedContentProps } from './types'
import s from './style.module.css'

const RelatedContent = ({
Expand Down Expand Up @@ -35,9 +35,9 @@ const RelatedContent = ({
))}
</div>
<div className={s.cta} data-testid="wpl-cta-container">
<StandaloneLink appearance={appearance} href={cta.href}>
<Link href={cta.href} legacyBehavior>
{cta.text}
</StandaloneLink>
</Link>
</div>
</div>
)
Expand Down
14 changes: 14 additions & 0 deletions packages/related-content/style.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,18 @@

.cta {
grid-column: 1 / -1;

& a {
font-weight: 500;
font-size: 17px;
line-height: 20px;
letter-spacing: 0.0125em;
text-decoration: underline;
text-underline-offset: 3px;
display: inline;

@nest .dark & {
color: var(--wpl-neutral-300);
}
}
}

1 comment on commit 4734c65

@vercel
Copy link

@vercel vercel bot commented on 4734c65 Dec 13, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.