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

fix(v2): remove invalid label attribute of footer links #1980

Merged
merged 3 commits into from
Nov 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions packages/docusaurus-theme-classic/src/theme/Footer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import useBaseUrl from '@docusaurus/useBaseUrl';
import styles from './styles.module.css';

function FooterLink({item}) {
const toUrl = useBaseUrl(item.to);
function FooterLink({to, href, label, ...props}) {
const toUrl = useBaseUrl(to);
return (
<Link
className="footer__link-item"
{...item}
{...(item.href
{...(href
? {
target: '_blank',
rel: 'noopener noreferrer',
href: item.href,
href,
}
: {
to: toUrl,
})}>
{item.label}
})}
{...props}>
{label}
Copy link
Contributor

Choose a reason for hiding this comment

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

Now i wonder if we should put it right before label instead ? Otherwise the props cannot override rel and target for href

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, exactly, you are absolutely right, fixed!

</Link>
);
}
Expand Down Expand Up @@ -77,7 +77,7 @@ function Footer() {
/>
) : (
<li key={item.href || item.to} className="footer__item">
<FooterLink item={item} />
<FooterLink {...item} />
</li>
),
)}
Expand Down