11import React , { useEffect , useRef } from 'react'
2- import { IconButton } from '@mui/material'
32import { makeStyles } from 'tss-react/mui'
43import { observer } from 'mobx-react'
54import { IBaseViewModel } from '@jbrowse/core/pluggableElementTypes/models'
5+ import { getSession } from '@jbrowse/core/util'
66
77// icons
8- import CloseIcon from '@mui/icons-material/Close'
9- import MinimizeIcon from '@mui/icons-material/Minimize'
10- import AddIcon from '@mui/icons-material/Add'
118import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight'
129
1310// locals
1411import ViewMenu from './ViewMenu'
1512import ViewContainerTitle from './ViewContainerTitle'
16- import { getSession } from '@jbrowse/core/util '
13+ import ViewHeaderButtons from './ViewHeaderButtons '
1714
1815const useStyles = makeStyles ( ) ( theme => ( {
1916 icon : {
@@ -31,32 +28,6 @@ const useStyles = makeStyles()(theme => ({
3128 } ,
3229} ) )
3330
34- const ViewButtons = observer ( function ( {
35- view,
36- onClose,
37- onMinimize,
38- } : {
39- view : IBaseViewModel
40- onClose : ( ) => void
41- onMinimize : ( ) => void
42- } ) {
43- const { classes } = useStyles ( )
44- return (
45- < >
46- < IconButton data-testid = "minimize_view" onClick = { onMinimize } >
47- { view . minimized ? (
48- < AddIcon className = { classes . icon } fontSize = "small" />
49- ) : (
50- < MinimizeIcon className = { classes . icon } fontSize = "small" />
51- ) }
52- </ IconButton >
53- < IconButton data-testid = "close_view" onClick = { onClose } >
54- < CloseIcon className = { classes . icon } fontSize = "small" />
55- </ IconButton >
56- </ >
57- )
58- } )
59-
6031const ViewHeader = observer ( function ( {
6132 view,
6233 onClose,
@@ -66,7 +37,7 @@ const ViewHeader = observer(function ({
6637 onClose : ( ) => void
6738 onMinimize : ( ) => void
6839} ) {
69- const { classes } = useStyles ( )
40+ const { classes, cx } = useStyles ( )
7041 const scrollRef = useRef < HTMLDivElement > ( null )
7142 const session = getSession ( view )
7243
@@ -78,7 +49,7 @@ const ViewHeader = observer(function ({
7849 }
7950 } , [ ] )
8051 return (
81- < div ref = { scrollRef } className = { classes . viewHeader } >
52+ < div ref = { scrollRef } className = { cx ( 'viewHeader' , classes . viewHeader ) } >
8253 < ViewMenu model = { view } IconProps = { { className : classes . icon } } />
8354 < div className = { classes . grow } />
8455 < div className = { classes . viewTitle } >
@@ -88,7 +59,11 @@ const ViewHeader = observer(function ({
8859 < ViewContainerTitle view = { view } />
8960 </ div >
9061 < div className = { classes . grow } />
91- < ViewButtons onClose = { onClose } onMinimize = { onMinimize } view = { view } />
62+ < ViewHeaderButtons
63+ onClose = { onClose }
64+ onMinimize = { onMinimize }
65+ view = { view }
66+ />
9267 </ div >
9368 )
9469} )
0 commit comments