サイド・バーの幅を可変に (#385) #396

マージ済み
みてるぞ が 4 個のコミットを feature/385 から main へマージ 2026-07-05 03:38:01 +09:00
コミット 7e0b6910f6 の変更だけを表示してゐます - すべてのコミットを表示
+5 -3
ファイルの表示
@@ -86,11 +86,13 @@ const SidebarComponent: FC<Props> = ({
const getClampedWidth = useCallback (( const getClampedWidth = useCallback ((
nextWidth: number, nextWidth: number,
containerWidth: number): number => { containerWidth: number): number => {
const dynamicMaxWidth = getSidebarMaxWidth (containerWidth) const viewportWidth =
typeof window === 'undefined' ? containerWidth : window.innerWidth
const viewportMaxWidth = Math.floor (viewportWidth * MAX_VIEWPORT_WIDTH_RATIO)
const maxAllowedWidth = const maxAllowedWidth =
maxWidth == null maxWidth == null
? dynamicMaxWidth ? getSidebarMaxWidth (containerWidth)
: Math.max (MIN_SIDEBAR_WIDTH, Math.min (dynamicMaxWidth, maxWidth)) : Math.max (MIN_SIDEBAR_WIDTH, Math.min (viewportMaxWidth, maxWidth))
return Math.min (maxAllowedWidth, Math.max (MIN_SIDEBAR_WIDTH, nextWidth)) return Math.min (maxAllowedWidth, Math.max (MIN_SIDEBAR_WIDTH, nextWidth))
}, [maxWidth]) }, [maxWidth])