Skip to content

Commit

Permalink
refactor(v2): clean-ups and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lex111 committed Feb 18, 2021
1 parent 5f91f41 commit d19b10c
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@

.sidebarItem {
list-style-type: none;
margin-top: 0.8rem;
margin-bottom: 0.8rem;
margin: 0.8rem 0;
}

.sidebarItemLink {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function SkipToContent(): JSX.Element {

return (
<div ref={containerRef}>
<a href="#main" className={styles.skipToContent} onClick={handleSkip}>
<a href="#" className={styles.skipToContent} onClick={handleSkip}>
<Translate
id="theme.SkipToContent.skipToMainContent"
description="The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

.tableOfContents {
display: inherit;
max-height: calc(100vh - (var(--ifm-navbar-height) + 2rem));
overflow-y: auto;
position: sticky;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import type {TOCProps} from '@theme/TOC';
import styles from './styles.module.css';
import {TOCItem} from '@docusaurus/types';

const LINK_CLASS_NAME = styles['table-of-contents__link--inline'];

/* eslint-disable jsx-a11y/control-has-associated-label */
function HeadingsInline({
toc,
Expand All @@ -30,7 +28,6 @@ function HeadingsInline({
<li key={heading.id}>
<a
href={`#${heading.id}`}
className={LINK_CLASS_NAME}
// Developer provided the HTML, so assume it's safe.
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{__html: heading.value}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
}

:global(.react-toggle--focus .react-toggle-thumb),
:global(.react-toggle-thumb:hover) {
:global(.react-toggle:hover .react-toggle-thumb) {
box-shadow: 0px 0px 2px 3px var(--ifm-color-primary);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const useHideableNavbar = (hideOnScroll: boolean): useHideableNavbarReturns => {
}

if (scrollTop < navbarHeight) {
setIsNavbarVisible(true);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import {useEffect, useState} from 'react';

import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
import type {WindowSize} from '@theme/hooks/useWindowSize';

const desktopThresholdWidth = 996;
Expand All @@ -17,7 +18,7 @@ const windowSizes = {
} as const;

function useWindowSize(): WindowSize | undefined {
const isClient = typeof window !== 'undefined';
const isClient = ExecutionEnvironment.canUseDOM;

function getSize() {
if (!isClient) {
Expand Down

0 comments on commit d19b10c

Please sign in to comment.