mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-04 12:47:14 +02:00
fix(v2): remove invalid label attribute of footer links (#1980)
* fix(v2): remove invalid attributes of footer links * Add rest props * Fix override props
This commit is contained in:
parent
137e548aef
commit
9cbb7030fa
1 changed files with 8 additions and 8 deletions
|
@ -13,22 +13,22 @@ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||||
import useBaseUrl from '@docusaurus/useBaseUrl';
|
import useBaseUrl from '@docusaurus/useBaseUrl';
|
||||||
import styles from './styles.module.css';
|
import styles from './styles.module.css';
|
||||||
|
|
||||||
function FooterLink({item}) {
|
function FooterLink({to, href, label, ...props}) {
|
||||||
const toUrl = useBaseUrl(item.to);
|
const toUrl = useBaseUrl(to);
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
className="footer__link-item"
|
className="footer__link-item"
|
||||||
{...item}
|
{...(href
|
||||||
{...(item.href
|
|
||||||
? {
|
? {
|
||||||
target: '_blank',
|
target: '_blank',
|
||||||
rel: 'noopener noreferrer',
|
rel: 'noopener noreferrer',
|
||||||
href: item.href,
|
href,
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
to: toUrl,
|
to: toUrl,
|
||||||
})}>
|
})}
|
||||||
{item.label}
|
{...props}>
|
||||||
|
{label}
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ function Footer() {
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<li key={item.href || item.to} className="footer__item">
|
<li key={item.href || item.to} className="footer__item">
|
||||||
<FooterLink item={item} />
|
<FooterLink {...item} />
|
||||||
</li>
|
</li>
|
||||||
),
|
),
|
||||||
)}
|
)}
|
||||||
|
|
Loading…
Add table
Reference in a new issue