fix: No reserving space in sidebar for overflow (#2807)
* fix: No reserving space in sidebar for overflow closes #2486 Co-authored-by: Charles Harries <charles@harries.me>
This commit is contained in:
12
.babelrc
12
.babelrc
@@ -25,5 +25,17 @@
|
|||||||
"@babel/plugin-transform-destructuring",
|
"@babel/plugin-transform-destructuring",
|
||||||
"@babel/plugin-transform-regenerator",
|
"@babel/plugin-transform-regenerator",
|
||||||
"transform-class-properties"
|
"transform-class-properties"
|
||||||
|
],
|
||||||
|
"env": {
|
||||||
|
"production": {
|
||||||
|
"plugins": [
|
||||||
|
[
|
||||||
|
"styled-components",
|
||||||
|
{
|
||||||
|
"displayName": false
|
||||||
|
}
|
||||||
]
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -250,9 +250,8 @@ function DocumentLink(
|
|||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'match' implicitly has an 'any' type.
|
|
||||||
isActive={(match, location) =>
|
isActive={(match, location) =>
|
||||||
match && location.search !== "?starred"
|
!!match && location.search !== "?starred"
|
||||||
}
|
}
|
||||||
isActiveDrop={isOverReparent && canDropToReparent}
|
isActiveDrop={isOverReparent && canDropToReparent}
|
||||||
depth={depth}
|
depth={depth}
|
||||||
|
|||||||
@@ -4,7 +4,11 @@
|
|||||||
// it avoids recalculating the link match again.
|
// it avoids recalculating the link match again.
|
||||||
import { Location, createLocation } from "history";
|
import { Location, createLocation } from "history";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { __RouterContext as RouterContext, matchPath } from "react-router";
|
import {
|
||||||
|
__RouterContext as RouterContext,
|
||||||
|
matchPath,
|
||||||
|
match,
|
||||||
|
} from "react-router";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import scrollIntoView from "smooth-scroll-into-view-if-needed";
|
import scrollIntoView from "smooth-scroll-into-view-if-needed";
|
||||||
|
|
||||||
@@ -32,7 +36,7 @@ export type Props = React.HTMLAttributes<HTMLAnchorElement> & {
|
|||||||
className?: string;
|
className?: string;
|
||||||
scrollIntoViewIfNeeded?: boolean;
|
scrollIntoViewIfNeeded?: boolean;
|
||||||
exact?: boolean;
|
exact?: boolean;
|
||||||
isActive?: any;
|
isActive?: (match: match | null, location: Location) => boolean;
|
||||||
location?: Location;
|
location?: Location;
|
||||||
strict?: boolean;
|
strict?: boolean;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import * as React from "react";
|
|||||||
import styled, { useTheme } from "styled-components";
|
import styled, { useTheme } from "styled-components";
|
||||||
import breakpoint from "styled-components-breakpoint";
|
import breakpoint from "styled-components-breakpoint";
|
||||||
import EventBoundary from "~/components/EventBoundary";
|
import EventBoundary from "~/components/EventBoundary";
|
||||||
|
import NudeButton from "~/components/NudeButton";
|
||||||
import { NavigationNode } from "~/types";
|
import { NavigationNode } from "~/types";
|
||||||
import NavLink, { Props as NavLinkProps } from "./NavLink";
|
import NavLink, { Props as NavLinkProps } from "./NavLink";
|
||||||
|
|
||||||
@@ -153,8 +154,27 @@ const Link = styled(NavLink)<{ $isActiveDrop?: boolean }>`
|
|||||||
transparentize("0.25", props.theme.sidebarItemBackground)};
|
transparentize("0.25", props.theme.sidebarItemBackground)};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
& + ${Actions} {
|
||||||
|
${NudeButton} {
|
||||||
|
background: ${(props) => props.theme.sidebarBackground};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus + ${Actions} {
|
||||||
|
${NudeButton} {
|
||||||
|
background: ${(props) =>
|
||||||
|
transparentize("0.25", props.theme.sidebarItemBackground)};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&[aria-current="page"] + ${Actions} {
|
||||||
|
${NudeButton} {
|
||||||
|
background: ${(props) => props.theme.sidebarItemBackground};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
${breakpoint("tablet")`
|
${breakpoint("tablet")`
|
||||||
padding: 4px 32px 4px 16px;
|
padding: 4px 8px 4px 16px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
`}
|
`}
|
||||||
|
|
||||||
|
|||||||
@@ -75,9 +75,8 @@ function StarredLink({ depth, title, to, documentId, collectionId }: Props) {
|
|||||||
<SidebarLink
|
<SidebarLink
|
||||||
depth={depth}
|
depth={depth}
|
||||||
to={`${to}?starred`}
|
to={`${to}?starred`}
|
||||||
// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'match' implicitly has an 'any' type.
|
|
||||||
isActive={(match, location) =>
|
isActive={(match, location) =>
|
||||||
match && location.search === "?starred"
|
!!match && location.search === "?starred"
|
||||||
}
|
}
|
||||||
label={
|
label={
|
||||||
<>
|
<>
|
||||||
|
|||||||
Reference in New Issue
Block a user