buster/web/src/layouts/ChatLayout/hooks/useDefaultSplitterLayout.ts

16 lines
440 B
TypeScript

import { useMemo } from 'react';
export const useDefaultSplitterLayout = ({
defaultSelectedLayout
}: {
defaultSelectedLayout: 'chat' | 'file' | 'both';
}) => {
const defaultSplitterLayout = useMemo(() => {
if (defaultSelectedLayout === 'chat') return ['100%', '0%'];
if (defaultSelectedLayout === 'file') return ['0%', '100%'];
return ['325px', 'auto'];
}, [defaultSelectedLayout]);
return defaultSplitterLayout;
};