mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-29 10:17:55 +02:00
chore(v2): upgrade Infima (#2669)
* chore(v2): upgrade Infima * Make proper classes for active items * upgrade Infima to v0.2.0-alpha.9 Co-authored-by: Alexey Pyltsyn <lex61rus@gmail.com>
This commit is contained in:
parent
c0e531e5d9
commit
1d8cc4b10f
4 changed files with 33 additions and 10 deletions
|
@ -1,5 +1,15 @@
|
|||
# Docusaurus 2 Changelog
|
||||
|
||||
## 2.0.0-alpha.51
|
||||
|
||||
#### :boom: Breaking Change
|
||||
|
||||
- `infima`
|
||||
- The following infima variables have been renamed for consistency:
|
||||
- `--ifm-font-base-color` → `--ifm-font-color-base`
|
||||
- `--ifm-font-base-color-inverse` → `--ifm-font-color-base-inverse`
|
||||
- `--ifm-font-color-secondary` → `--ifm-font-color-secondary`
|
||||
|
||||
## 2.0.0-alpha.50 (2020-04-02)
|
||||
|
||||
**HOTFIX for 2.0.0-alpha.49**.
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"@mdx-js/react": "^1.5.8",
|
||||
"classnames": "^2.2.6",
|
||||
"clipboard": "^2.0.6",
|
||||
"infima": "0.2.0-alpha.6",
|
||||
"infima": "0.2.0-alpha.9",
|
||||
"parse-numeric-range": "^0.0.2",
|
||||
"prism-react-renderer": "^1.1.0",
|
||||
"prismjs": "^1.20.0",
|
||||
|
|
|
@ -20,7 +20,15 @@ import useLogo from '@theme/hooks/useLogo';
|
|||
|
||||
import styles from './styles.module.css';
|
||||
|
||||
function NavLink({activeBasePath, to, href, label, position, ...props}) {
|
||||
function NavLink({
|
||||
activeBasePath,
|
||||
to,
|
||||
href,
|
||||
label,
|
||||
position,
|
||||
activeClassName = 'navbar__link--active',
|
||||
...props
|
||||
}) {
|
||||
const toUrl = useBaseUrl(to);
|
||||
const activeBaseUrl = useBaseUrl(activeBasePath);
|
||||
|
||||
|
@ -34,7 +42,7 @@ function NavLink({activeBasePath, to, href, label, position, ...props}) {
|
|||
}
|
||||
: {
|
||||
isNavLink: true,
|
||||
activeClassName: 'navbar__link--active',
|
||||
activeClassName,
|
||||
to: toUrl,
|
||||
...(activeBasePath
|
||||
? {
|
||||
|
@ -50,8 +58,11 @@ function NavLink({activeBasePath, to, href, label, position, ...props}) {
|
|||
}
|
||||
|
||||
function NavItem({items, position, className, ...props}) {
|
||||
const navLinkClassNames = (extraClassName) =>
|
||||
classnames('navbar__item', 'navbar__link', extraClassName);
|
||||
const navLinkClassNames = (extraClassName, isDropdownItem) =>
|
||||
classnames(extraClassName, {
|
||||
'navbar__item navbar__link': !isDropdownItem,
|
||||
dropdown__link: isDropdownItem,
|
||||
});
|
||||
|
||||
if (!items) {
|
||||
return <NavLink className={navLinkClassNames(className)} {...props} />;
|
||||
|
@ -71,7 +82,8 @@ function NavItem({items, position, className, ...props}) {
|
|||
({className: childItemClassName, ...linkItemInnerProps}, i) => (
|
||||
<li key={i}>
|
||||
<NavLink
|
||||
className={navLinkClassNames(childItemClassName)}
|
||||
activeClassName="dropdown__link--active"
|
||||
className={navLinkClassNames(childItemClassName, true)}
|
||||
{...linkItemInnerProps}
|
||||
/>
|
||||
</li>
|
||||
|
@ -106,6 +118,7 @@ function MobileNavItem({items, className, ...props}) {
|
|||
({className: childItemClassName, ...linkItemInnerProps}, i) => (
|
||||
<li className="menu__list-item" key={i}>
|
||||
<NavLink
|
||||
activeClassName="menu__link--active"
|
||||
className={navLinkClassNames(childItemClassName)}
|
||||
{...linkItemInnerProps}
|
||||
onClick={props.onClick}
|
||||
|
|
|
@ -8710,10 +8710,10 @@ infer-owner@^1.0.3, infer-owner@^1.0.4:
|
|||
resolved "https://registry.yarnpkg.com/infer-owner/-/infer-owner-1.0.4.tgz#c4cefcaa8e51051c2a40ba2ce8a3d27295af9467"
|
||||
integrity sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==
|
||||
|
||||
infima@0.2.0-alpha.6:
|
||||
version "0.2.0-alpha.6"
|
||||
resolved "https://registry.yarnpkg.com/infima/-/infima-0.2.0-alpha.6.tgz#69233fc055a7e9eb08fd70e1497ff8e2a68dd928"
|
||||
integrity sha512-5Oin586QeBa5VdP8xpPuHB/BDg1D66+B5bFG67XPqKV8mD0hwKt2LJFYqoSJKGPBccxGBQpHEOFUd2sUSdhdGA==
|
||||
infima@0.2.0-alpha.9:
|
||||
version "0.2.0-alpha.9"
|
||||
resolved "https://registry.yarnpkg.com/infima/-/infima-0.2.0-alpha.9.tgz#2eea70b1571c8f55847e3f305ebd10814d2d09cf"
|
||||
integrity sha512-EXsGm6WhsabOangUkHyTx1qfKJdHF3Q9na/hJe387ytOkWu/phwjsA7T/C6b2KeRTdZl/DO1tFZsFc2+Qnif7A==
|
||||
|
||||
inflight@^1.0.4:
|
||||
version "1.0.6"
|
||||
|
|
Loading…
Add table
Reference in a new issue