import clsx from "clsx"; import { useContext } from "react"; import { t } from "../../i18n"; import { useDevice } from "../App"; import { SidebarPropsContext } from "./common"; import { CloseIcon, PinIcon } from "../icons"; import { withUpstreamOverride } from "../hoc/withUpstreamOverride"; import { Tooltip } from "../Tooltip"; export const SidebarDockButton = (props: { checked: boolean; onChange?(): void; }) => { return (
{" "}
); }; const _SidebarHeader: React.FC<{ children?: React.ReactNode; className?: string; }> = ({ children, className }) => { const device = useDevice(); const props = useContext(SidebarPropsContext); const renderDockButton = !!(device.canDeviceFitSidebar && props.dockable); const renderCloseButton = !!props.onClose; return (
{children} {(renderDockButton || renderCloseButton) && (
{renderDockButton && ( { props.onDock?.(!props.docked); }} /> )} {renderCloseButton && ( )}
)}
); }; const [Context, Component] = withUpstreamOverride(_SidebarHeader); /** @private */ export const SidebarHeaderComponents = { Context, Component };