mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-27 16:06:59 +02:00
refactor(v2): use react hooks on root app (#1095)
* refactor(v2): use functional component + react hooks for App * docusaurus/link * nits * review
This commit is contained in:
parent
72d1fa2d2a
commit
8695ed89a6
23 changed files with 65 additions and 58 deletions
|
@ -6,18 +6,12 @@
|
|||
*/
|
||||
|
||||
import React from 'react';
|
||||
import {NavLink} from 'react-router-dom';
|
||||
import Link from '@docusaurus/Link';
|
||||
import classnames from 'classnames';
|
||||
|
||||
import styles from './styles.module.css';
|
||||
|
||||
export default function SidebarLink({href, label}) {
|
||||
const isExternal = /^(https?:|\/\/)/.test(href);
|
||||
const Link = isExternal
|
||||
? // eslint-disable-next-line jsx-a11y/anchor-has-content
|
||||
({to, activeClassName, ...linkProps}) => <a {...linkProps} href={to} />
|
||||
: NavLink;
|
||||
|
||||
return (
|
||||
<li className={styles.sidebarListItem}>
|
||||
<Link
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue