-
Notifications
You must be signed in to change notification settings - Fork 67
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
[BD-46] docs: added 'Leave feedback' button to the top of the component page #2395
[BD-46] docs: added 'Leave feedback' button to the top of the component page #2395
Conversation
Thanks for the pull request, @PKulkoRaccoonGang! When this pull request is ready, tag your edX technical lead. |
✅ Deploy Preview for paragon-openedx ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
b97acef
to
279e7b7
Compare
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## master #2395 +/- ##
=======================================
Coverage 91.38% 91.38%
=======================================
Files 234 234
Lines 4157 4157
Branches 1001 1001
=======================================
Hits 3799 3799
Misses 351 351
Partials 7 7 ☔ View full report in Codecov by Sentry. |
279e7b7
to
f518e5d
Compare
<h1 className="mb-4">{mdx.frontmatter.title}</h1> | ||
<div className="d-flex justify-content-between"> | ||
<h1 className="mb-4">{mdx.frontmatter.title}</h1> | ||
<LeaveFeedback as={Hyperlink} /> |
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.
If we're using Hyperlink
here to get it to have the external launch icon, we may also want to include it on the other in-page "Leave feedback" link towards the bottom.
Likewise, we could also use as={Hyperlink}
in the docs site footer
such that we get the correct rel="noopener noreferrer"
attribute for security. That said, given none of the other external links in the footer include an external launch icon, we can use Hyperlink
's showLaunchIcon={false}
to hide the icon for the footer only.
<h1 className="mb-4">{mdx.frontmatter.title}</h1> | ||
<div className="d-flex justify-content-between"> | ||
<h1 className="mb-4">{mdx.frontmatter.title}</h1> | ||
<LeaveFeedback as={Hyperlink} /> |
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.
Per the issue, I believe the intent for "Leave feedback" now is to be a small Button
(variant="outline-primary"
) that acts as a Hyperlink
here in component-page-template
and below the page content (though not the footer).
<h1 className="mb-4">{mdx.frontmatter.title}</h1> | ||
<div className="d-flex justify-content-between"> | ||
<h1 className="mb-4">{mdx.frontmatter.title}</h1> | ||
<LeaveFeedback as={Hyperlink} /> |
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.
It looks like this defaults to using Nav.Link
styles by default, even though most uses of LeaveFeedback
don't actually intend to use those styles. I wonder if the use of LeaveFeedback
in the footer should be the exception that gets the Nav.Link
styles rather than having to override that in 2 of the 3 places the LeaveFeedback
component is used.
Is there a way to perhaps make this component a bit more flexible so the differing styles in the various use cases don't conflict?
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 the review! I replaced the top link and the bottom link with buttons, I also changed the implementation of links in the site footer. It seems to me that all links that lead to third-party resources should have rel="noopener noreferrer" and target="_blank ".
bcbca21
to
e873c97
Compare
e873c97
to
92358d0
Compare
www/src/components/PageLayout.tsx
Outdated
</Nav.Item> | ||
<Nav.Item> | ||
<Nav.Link className="muted-link" href="https://open.edx.org/"> | ||
<Hyperlink |
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 think you need to replace implementation in all these links. We should always use Nav.Link
component when we want to render a link inside a Nav
, that's exactly why this component exists.
Instead of using Hyperlink
and manually using nav-link
SCSS class (which should ideally be internal to Nav.Link
component) you can achieve the same result with
<Nav.Link
className="muted-link"
href="https://open.edx.org/"
target="_blank"
rel="noopener noreferrer"
>
Open edX
</Nav.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.
@viktorrusakov thanks for the review 👍
The transition from Nav.Link
to HyperLink
was due to my assumptions about the semantic meaning of the Nav.Link
component and its purpose. After researching the Bootstrap page for the Nav.Link
component, it seemed to me the right decision to use the HyperLink
component for navigation links, because the Nav.Link
component should probably be used to navigate the internal links of the application. It is for this reason that the Nav.Link
component does not have the corresponding attributes that HyperLink does.
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.
It still just renders an a
tag whether you use Nav.Link
or HyperLink
, but Nav.Link
ensures that the link looks correctly inside a nav
while for HyperLink
you need to add additional class (which is internal to Nav.Link
) to make it work.
I agree with your semantics reasoning (that nav probably shouldn't have external links in it), but your solution does not solve the underlying problem - in the DOM it still renders a nav
element with bunch of external links inside it. If we really care about this, then we need to remove nav
altogether and render HyperLink
's inside a ul
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.
Ok, I agree with you
Thanks 👍
www/src/components/LeaveFeedback.tsx
Outdated
|
||
const handleLinkFeedbackClick = () => { | ||
global.analytics.track('openedx.paragon.docs.leave_feedback.clicked'); | ||
}; | ||
|
||
if (isLink) { |
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 it also make more sense to leave Nav.Link
implementation here since we only use it inside Nav
component, e.g.
if (isNavLink) {
return (
<Nav.Link
onClick={handleLinkFeedbackClick}
href={FEEDBACK_URL}
target="_blank"
rel="noopener noreferrer"
{...props}
>
{leaveFeedbackLinkTitle}
</Nav.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.
Done
c7f72f2
to
c6572a5
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.
LGTM!
@PKulkoRaccoonGang 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
🎉 This PR is included in version 20.45.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
Issue: #2373
Deploy Preview
Include a direct link to your changes in this PR's deploy preview here (e.g., a specific component page).
Merge Checklist
example
app?wittjeff
andadamstankiewicz
as reviewers on this PR.Post-merge Checklist