2023-03-06 12:05:45 -05:00
|
|
|
import React, { useState } from 'react';
|
|
|
|
import GlossarySearch from './GlossarySearch';
|
|
|
|
import GlossaryBrowser from './GlossaryBrowser/GlossaryBrowser';
|
|
|
|
import { ProfileSidebarResizer } from '../entity/shared/containers/profile/sidebar/ProfileSidebarResizer';
|
2023-09-18 16:14:33 -04:00
|
|
|
import { SidebarWrapper } from '../shared/sidebar/components';
|
2023-03-06 12:05:45 -05:00
|
|
|
|
|
|
|
export const MAX_BROWSER_WIDTH = 500;
|
|
|
|
export const MIN_BROWSWER_WIDTH = 200;
|
|
|
|
|
|
|
|
export default function GlossarySidebar() {
|
|
|
|
const [browserWidth, setBrowserWith] = useState(window.innerWidth * 0.2);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
2023-10-19 15:33:54 -04:00
|
|
|
<SidebarWrapper width={browserWidth} data-testid="glossary-browser-sidebar">
|
2023-03-06 12:05:45 -05:00
|
|
|
<GlossarySearch />
|
|
|
|
<GlossaryBrowser openToEntity />
|
2023-09-18 16:14:33 -04:00
|
|
|
</SidebarWrapper>
|
2023-03-06 12:05:45 -05:00
|
|
|
<ProfileSidebarResizer
|
|
|
|
setSidePanelWidth={(width) =>
|
|
|
|
setBrowserWith(Math.min(Math.max(width, MIN_BROWSWER_WIDTH), MAX_BROWSER_WIDTH))
|
|
|
|
}
|
|
|
|
initialSize={browserWidth}
|
|
|
|
isSidebarOnLeft
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|