-
Notifications
You must be signed in to change notification settings - Fork 370
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
Tech story [M3-6795]: Consolidate Link & ExternalLink #9411
Tech story [M3-6795]: Consolidate Link & ExternalLink #9411
Conversation
c0b149a
to
eb7824c
Compare
packages/manager/src/App.tsx
Outdated
Opens an external site in a new window | ||
</span> | ||
</div> | ||
<GoTo open={goToOpen} onClose={() => setGoToOpen(false)} /> |
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.
Because of this PR we do not need these IDs to refer our markup to for external links. This was not the cleanest way ^
target="_blank" | ||
> | ||
:) | ||
</a> |
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 don't want to crush any attempt at humor in our codebase, but this seems over the top 🤣
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.
Humor crumbler! 🍪 No, agreed, this little easter egg has had it's run.
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.
Modifying the DocsLink to use comply to our new API - also cleaned it up and replaced its .mdx story
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.
Deleting this to not use yet another abstraction - this is for empty landing pages and we're making use of the new Link API now
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.
External Link shouldn't really be a stand alone now
onClick={onEdit} | ||
> | ||
Edit | ||
</LinkButton> |
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.
Small style adjustment I noticed was needed - unrelated to this refactor
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.
Nice catch on the abnormally large 'Edit'.
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 large edit button was in the mockups when we built the phone verification feature, but I'm cool with making it more normal. 😄
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.
Unrelated to this PR. pretty sure this will go away as well eventually, but for now it is being used and I converted it to use the right component VS spreading styles
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.
Goodbye ExternalLink
, it's been a slice
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.
Refactored the empty state landing pages to use the new API - we don't need yet another abstraction!
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.
Refactored DocsLink to use the new API. No need to abstract that much. Also moved its story under component/Link since they are very much related
92c3b32
to
0606937
Compare
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.
DocsLink has been refactored to use the new Link API instead of a previous button. Those should be links!
a080f9a
to
622373a
Compare
<span id="external-site-new-window"> | ||
Opens an external site in a new window | ||
</span> | ||
</div> |
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.
This is lo longer needed since we changed the API to no refer to those IDs
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.
Every link I could find looked good! Nice job on this... so much cleaner 🧼
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 all the work on this! It's exciting to have standardized our linking. I did a pretty thorough look at the diff and clicking around the areas you called out in the testing section. Approving, since I found no major issues - called out minor ones in comments.
I tried to keep an eye out for links that are currently external links and were previously ExternalLink
s with hideIcon
as a prop, because there's likely a UI reason we weren't displaying the icon and some styling is needed to make it better. I only caught a couple places where this was the place in OBJ (commented below); hopefully we don't come across others that I missed.
One other thing I found:
On http://localhost:3000/support/search/?query=test, there are links that are the wrong color in dark mode... and they're not actually links at all, but ListItems within the DocumentationResults
component. These should really be Links
. Mentioning it here, but it could be a follow up ticket if we want to stick with the current scope.
target="_blank" | ||
> | ||
:) | ||
</a> |
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.
Humor crumbler! 🍪 No, agreed, this little easter egg has had it's run.
</a> | ||
{props.isReply ? 'reply' : 'question'}. For more examples see this{' '} | ||
<Link external to="http://demo.showdownjs.com/"> | ||
markdown cheatsheet |
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 think this should still be capitalized since it's the name of a language
markdown cheatsheet | |
Markdown cheatsheet |
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.
done!
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.
TIL a Hively
component exists!
onClick={onEdit} | ||
> | ||
Edit | ||
</LinkButton> |
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.
Nice catch on the abnormally large 'Edit'.
<Link to={currentProvider.href}> | ||
{`${currentProvider.displayName}` + ` website`} | ||
</Link> |
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.
<Link to={currentProvider.href}> | |
{`${currentProvider.displayName}` + ` website`} | |
</Link> | |
<Link external to={currentProvider.href}> | |
{`${currentProvider.displayName}` + ` website`} | |
</Link> |
Shouldn't this be considered an external link?
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.
fixed!
<Link external to={`https://${hostname}`}> | ||
{truncateMiddle(hostname, 50)} | ||
</Link> |
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.
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.
fixed!
<Link external to={url}> | ||
{truncateMiddle(url, 50)} | ||
</Link> |
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 issue as BucketDetailsDrawer, I think.
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.
fixed!
</div> | ||
</> | ||
); | ||
expect(flattenChildrenIntoAriaLabel(children)).toBe('First Second Third'); |
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.
Thanks for these tests. I was looking to understand if this function was doing what I 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.
Empty state landing looks better with white icons (in dark mode) and the docs arrow icon spacing change!
* This story is deprecated and will be removed in a future release. | ||
* Please use the `ExternalLink` component when you need to render an external link. | ||
* An instance of Link component given an absolute URL, rendering an `a` tag with `target="_blank"`. | ||
* This version provides an `external` prop, usually belonging to the same domain or a subdomain.<br /> |
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.
* This version provides an `external` prop, usually belonging to the same domain or a subdomain.<br /> | |
* This version provides an `external` prop, to be used when the site does not belong to the same domain or a subdomain.<br /> |
Is this what we mean here? Otherwise, I'm a little confused.
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.
yes! you're right, fixed!
622373a
to
d8b71b6
Compare
@bnussman-akamai @mjac0bs thanks so much for the reviews! I addressed all feedback and also fixed the wrong markup on the search result page |
6e2253f
to
c7d0583
Compare
Description 📝
One component to rule them all! 💍
This PR refactors the
Link
component so it can be used for all three use cases:Link
component from React Router.a
tag withtarget="_blank"
.external
prop, which will render ana
tag withtarget="_blank"
and an external link icon.Preview 📷
Visual changes should only pertain to the presence (or not) of some external links. Remember that links opening in a new tab but directing a user to an Akamai or Linode domain/subdomain should not feature an external link icon
How to test 🧪
I can ask for reviewers to verify every link modified by this PR, however the areas to look for visual regressions or bad links should be: