diff --git a/src/components/ResizeHandler.tsx b/src/components/ResizeHandler.tsx index 2675a11..177de70 100644 --- a/src/components/ResizeHandler.tsx +++ b/src/components/ResizeHandler.tsx @@ -5,13 +5,20 @@ import { Size } from './SideBarBodyWrapper' type Props = { size: Size onResize(size: Size): void + onResetSize?(): void onResizeStateChange?(state: ResizeState): void style?: React.CSSProperties } type ResizeState = 'idle' | 'resizing' -export function HorizontalResizeHandler({ onResize, onResizeStateChange, size, style }: Props) { +export function HorizontalResizeHandler({ + onResize, + onResetSize, + onResizeStateChange, + size, + style, +}: Props) { const pointerDown = React.useRef(false) const startX = React.useRef(0) const baseSize = React.useRef(size) @@ -51,7 +58,12 @@ export function HorizontalResizeHandler({ onResize, onResizeStateChange, size, s }, []) return ( -
+
) diff --git a/src/components/SideBarBodyWrapper.tsx b/src/components/SideBarBodyWrapper.tsx index b18599e..d0b1c10 100644 --- a/src/components/SideBarBodyWrapper.tsx +++ b/src/components/SideBarBodyWrapper.tsx @@ -2,6 +2,7 @@ import { HorizontalResizeHandler } from 'components/ResizeHandler' import { useConfigs } from 'containers/ConfigsContext' import * as React from 'react' import { useDebounce, useWindowSize } from 'react-use' +import { defaultConfigs } from 'utils/config/helper' import { cx } from 'utils/cx' import { setResizingState } from 'utils/DOMHelper' import * as features from 'utils/features' @@ -69,6 +70,7 @@ export function SideBarBodyWrapper({ {features.resize && ( setSize(defaultConfigs.sideBarWidth)} onResizeStateChange={state => { blockLeaveRef.current = state === 'resizing' }} diff --git a/src/utils/config/helper.ts b/src/utils/config/helper.ts index 16b71fd..9680976 100644 --- a/src/utils/config/helper.ts +++ b/src/utils/config/helper.ts @@ -35,7 +35,7 @@ enum configKeys { sidebarToggleMode = 'sidebarToggleMode', } -const defaultConfigs: Config = { +export const defaultConfigs: Config = { sideBarWidth: 260, shortcut: undefined, accessToken: '',