Skip to content
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

Conversation

PKulkoRaccoonGang
Copy link
Contributor

@PKulkoRaccoonGang PKulkoRaccoonGang commented Jun 21, 2023

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

  • If your update includes visual changes, have they been reviewed by a designer? Send them a link to the Netlify deploy preview, if applicable.
  • Does your change adhere to the documented style conventions?
  • Do any prop types have missing descriptions in the Props API tables in the documentation site (check deploy preview)?
  • Were your changes tested using all available themes (see theme switcher in the header of the deploy preview, under the "Settings" icon)?
  • Were your changes tested in the example app?
  • Is there adequate test coverage for your changes?
  • Consider whether this change needs to reviewed/QA'ed for accessibility (a11y). If so, please add wittjeff and adamstankiewicz as reviewers on this PR.

Post-merge Checklist

  • Verify your changes were released to NPM at the expected version.
  • If you'd like, share your contribution in #show-and-tell.
  • 🎉 🙌 Celebrate! Thanks for your contribution.

@openedx-webhooks openedx-webhooks added the blended PR is managed through 2U's blended developmnt program label Jun 21, 2023
@openedx-webhooks
Copy link

Thanks for the pull request, @PKulkoRaccoonGang!

When this pull request is ready, tag your edX technical lead.

@netlify
Copy link

netlify bot commented Jun 21, 2023

Deploy Preview for paragon-openedx ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit c6572a5
🔍 Latest deploy log https://app.netlify.com/sites/paragon-openedx/deploys/64b1233d34fba9000870aef9
😎 Deploy Preview https://deploy-preview-2395--paragon-openedx.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@codecov
Copy link

codecov bot commented Jun 22, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (b24807d) 91.38% compared to head (7a79fa8) 91.38%.

❗ Current head 7a79fa8 differs from pull request most recent head c6572a5. Consider uploading reports for the commit c6572a5 to get more accurate results

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

@PKulkoRaccoonGang PKulkoRaccoonGang force-pushed the Peter_Kulko/leave-feedback-on-the-top branch from 279e7b7 to f518e5d Compare June 22, 2023 08:22
<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} />
Copy link
Member

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} />
Copy link
Member

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} />
Copy link
Member

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?

Copy link
Contributor Author

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 ".

@PKulkoRaccoonGang PKulkoRaccoonGang force-pushed the Peter_Kulko/leave-feedback-on-the-top branch 3 times, most recently from bcbca21 to e873c97 Compare June 29, 2023 08:43
</Nav.Item>
<Nav.Item>
<Nav.Link className="muted-link" href="https://open.edx.org/">
<Hyperlink
Copy link
Contributor

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>

Copy link
Contributor Author

@PKulkoRaccoonGang PKulkoRaccoonGang Jul 13, 2023

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.

An interesting article about our question

Copy link
Contributor

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.

Copy link
Contributor Author

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 👍


const handleLinkFeedbackClick = () => {
global.analytics.track('openedx.paragon.docs.leave_feedback.clicked');
};

if (isLink) {
Copy link
Contributor

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>
  )
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@PKulkoRaccoonGang PKulkoRaccoonGang force-pushed the Peter_Kulko/leave-feedback-on-the-top branch from c7f72f2 to c6572a5 Compare July 14, 2023 10:28
Copy link
Member

@adamstankiewicz adamstankiewicz left a comment

Choose a reason for hiding this comment

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

LGTM!

@adamstankiewicz adamstankiewicz merged commit 00dd998 into openedx:master Jul 14, 2023
@openedx-webhooks
Copy link

@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.

@edx-semantic-release
Copy link
Contributor

🎉 This PR is included in version 20.45.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blended PR is managed through 2U's blended developmnt program raccoon-gang released
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants