mirror of
https://github.com/outline/outline.git
synced 2026-11-22 05:51:43 +03:00
chore: Remove ability to collapse sidebar on shared links (#10531)
* fix: Remove ability to collapse sidebar on shared links * fix: Existing collapsed sidebars should be forced open
This commit is contained in:
1 parent
4d5895d2a8
commit
4631b5ccaa
2 files changed
+13
-11
No files matched your search
@@ -47,7 +47,7 @@ function SharedSidebar({ share }: Props) {
|
||||
}
|
||||
|
||||
return (
|
||||
<StyledSidebar $hoverTransition={!teamAvailable}>
|
||||
<StyledSidebar $hoverTransition={!teamAvailable} canResize={false}>
|
||||
{teamAvailable && (
|
||||
<SidebarButton
|
||||
title={team.name}
|
||||
@@ -57,9 +57,7 @@ function SharedSidebar({ share }: Props) {
|
||||
onClick={() =>
|
||||
history.push(user ? homePath() : sharedModelPath(shareId))
|
||||
}
|
||||
>
|
||||
<ToggleSidebar />
|
||||
</SidebarButton>
|
||||
/>
|
||||
)}
|
||||
<ScrollContainer topShadow flex>
|
||||
<TopSection>
|
||||
|
||||
@@ -25,13 +25,15 @@ import { useTranslation } from "react-i18next";
|
||||
const ANIMATION_MS = 250;
|
||||
|
||||
type Props = {
|
||||
children: React.ReactNode;
|
||||
hidden?: boolean;
|
||||
/** Whether the sidebar can be resized and collapsed, defaults to true. */
|
||||
canResize?: boolean;
|
||||
className?: string;
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
const Sidebar = React.forwardRef<HTMLDivElement, Props>(function _Sidebar(
|
||||
{ children, hidden = false, className }: Props,
|
||||
{ children, hidden = false, canResize = true, className }: Props,
|
||||
ref: React.RefObject<HTMLDivElement>
|
||||
) {
|
||||
const [isCollapsing, setCollapsing] = React.useState(false);
|
||||
@@ -43,7 +45,7 @@ const Sidebar = React.forwardRef<HTMLDivElement, Props>(function _Sidebar(
|
||||
const user = useCurrentUser({ rejectOnEmpty: false });
|
||||
const isMobile = useMobile();
|
||||
const width = ui.sidebarWidth;
|
||||
const collapsed = ui.sidebarIsClosed;
|
||||
const collapsed = ui.sidebarIsClosed && canResize;
|
||||
const maxWidth = theme.sidebarMaxWidth;
|
||||
const minWidth = theme.sidebarMinWidth + 16; // padding
|
||||
|
||||
@@ -254,10 +256,12 @@ const Sidebar = React.forwardRef<HTMLDivElement, Props>(function _Sidebar(
|
||||
</SidebarButton>
|
||||
</AccountMenu>
|
||||
)}
|
||||
<ResizeBorder
|
||||
onMouseDown={handleMouseDown}
|
||||
onDoubleClick={ui.sidebarIsClosed ? undefined : handleReset}
|
||||
/>
|
||||
{canResize && (
|
||||
<ResizeBorder
|
||||
onMouseDown={handleMouseDown}
|
||||
onDoubleClick={ui.sidebarIsClosed ? undefined : handleReset}
|
||||
/>
|
||||
)}
|
||||
</Container>
|
||||
{ui.mobileSidebarVisible && <Backdrop onClick={ui.toggleMobileSidebar} />}
|
||||
</TooltipProvider>
|
||||
|
||||
Reference in new issue
Block a user