Skip to content
Snippets Groups Projects
Commit a1c52e24 authored by Chris Beer's avatar Chris Beer
Browse files

Pull window sidebar styles up

parent 30776ddb
Branches
No related tags found
2 merge requests!19Draft: Merge video support into mui5,!18Only nudge over badge content for the WindowListButton; it needs special...
import { Component } from 'react'; import { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { alpha } from '@mui/material/styles'; import { alpha, styled } from '@mui/material/styles';
import classNames from 'classnames'; import classNames from 'classnames';
import Paper from '@mui/material/Paper'; import Paper from '@mui/material/Paper';
import Stack from '@mui/material/Stack'; import Stack from '@mui/material/Stack';
...@@ -13,6 +13,21 @@ import ViewerNavigation from '../containers/ViewerNavigation'; ...@@ -13,6 +13,21 @@ import ViewerNavigation from '../containers/ViewerNavigation';
import ns from '../config/css-ns'; import ns from '../config/css-ns';
import { PluginHook } from './PluginHook'; import { PluginHook } from './PluginHook';
const Root = styled(Paper, { name: 'WindowCanvasNavigationControls', slot: 'root' })(({ theme }) => ({
alignItems: 'center',
backgroundColor: alpha(theme.palette.background.paper, 0.5),
bottom: 0,
cursor: 'default',
display: 'flex',
flexDirection: 'column',
flexWrap: 'wrap',
justifyContent: 'center',
position: 'absolute',
textAlign: 'center',
width: '100%',
zIndex: 50,
}));
/** /**
* Represents the viewer controls in the mirador workspace. * Represents the viewer controls in the mirador workspace.
*/ */
...@@ -35,22 +50,8 @@ export class WindowCanvasNavigationControls extends Component { ...@@ -35,22 +50,8 @@ export class WindowCanvasNavigationControls extends Component {
if (!visible) return (<Typography style={visuallyHidden} component="div"><ViewerInfo windowId={windowId} /></Typography>); if (!visible) return (<Typography style={visuallyHidden} component="div"><ViewerInfo windowId={windowId} /></Typography>);
return ( return (
<Paper <Root
square square
sx={(theme) => ({
alignItems: 'center',
backgroundColor: alpha(theme.palette.background.paper, 0.5),
bottom: 0,
cursor: 'default',
display: 'flex',
flexDirection: 'column',
flexWrap: 'wrap',
justifyContent: 'center',
position: 'absolute',
textAlign: 'center',
width: '100%',
zIndex: 50,
})}
className={ className={
classNames( classNames(
ns('canvas-nav'), ns('canvas-nav'),
...@@ -70,7 +71,7 @@ export class WindowCanvasNavigationControls extends Component { ...@@ -70,7 +71,7 @@ export class WindowCanvasNavigationControls extends Component {
<ViewerInfo windowId={windowId} /> <ViewerInfo windowId={windowId} />
<PluginHook {...this.props} /> <PluginHook {...this.props} />
</Paper> </Root>
); );
} }
} }
......
import { Component } from 'react'; import { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { styled } from '@mui/material/styles';
import Drawer from '@mui/material/Drawer'; import Drawer from '@mui/material/Drawer';
import WindowSideBarButtons from '../containers/WindowSideBarButtons'; import WindowSideBarButtons from '../containers/WindowSideBarButtons';
const Root = styled(Drawer, { name: 'WindowSideBar', slot: 'root' })(({ theme }) => ({
flexShrink: 0,
height: '100%',
order: -1000,
zIndex: theme.zIndex.appBar - 1,
}));
/** /**
* WindowSideBar * WindowSideBar
*/ */
...@@ -17,15 +25,9 @@ export class WindowSideBar extends Component { ...@@ -17,15 +25,9 @@ export class WindowSideBar extends Component {
} = this.props; } = this.props;
return ( return (
<Drawer <Root
variant="persistent" variant="persistent"
className={classes.drawer} className={classes.drawer}
sx={theme => ({
flexShrink: 0,
height: '100%',
order: -1000,
zIndex: theme.zIndex.appBar - 1,
})}
anchor={direction === 'rtl' ? 'right' : 'left'} anchor={direction === 'rtl' ? 'right' : 'left'}
PaperProps={{ PaperProps={{
'aria-label': t('sidebarPanelsNavigation'), 'aria-label': t('sidebarPanelsNavigation'),
...@@ -44,7 +46,7 @@ export class WindowSideBar extends Component { ...@@ -44,7 +46,7 @@ export class WindowSideBar extends Component {
open={sideBarOpen} open={sideBarOpen}
> >
<WindowSideBarButtons windowId={windowId} /> <WindowSideBarButtons windowId={windowId} />
</Drawer> </Root>
); );
} }
} }
......
import { Component } from 'react'; import { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { styled } from '@mui/material/styles';
import Badge from '@mui/material/Badge'; import Badge from '@mui/material/Badge';
import Tabs from '@mui/material/Tabs'; import Tabs from '@mui/material/Tabs';
import Tab from '@mui/material/Tab'; import Tab from '@mui/material/Tab';
...@@ -11,27 +12,29 @@ import LayersIcon from '@mui/icons-material/LayersSharp'; ...@@ -11,27 +12,29 @@ import LayersIcon from '@mui/icons-material/LayersSharp';
import SearchIcon from '@mui/icons-material/SearchSharp'; import SearchIcon from '@mui/icons-material/SearchSharp';
import CanvasIndexIcon from './icons/CanvasIndexIcon'; import CanvasIndexIcon from './icons/CanvasIndexIcon';
/** */ const Root = styled(Tabs, { name: 'WindowSideBarButtons', slot: 'root' })({
function TabButton({ t, value, ...tabProps }) { '& .MuiTabs-flexContainer': {
return ( flexDirection: 'column',
<Tooltip title={t('openCompanionWindow', { context: value })}> },
<Tab '&.MuiTabs-indicator': {
{...tabProps} display: 'none',
value={value} },
sx={{ });
const StyledTabButton = styled(Tab, { name: 'WindowSideBarButtons', slot: 'button' })(({ theme }) => ({
'&.Mui-selected': { '&.Mui-selected': {
borderRight: '2px solid', borderRight: '2px solid',
borderRightColor: 'primary.main', borderRightColor: theme.palette.primary.main,
}, },
'&.MuiTab-root': { '&.MuiTab-root': {
'&:active': { '&:active': {
backgroundColor: 'action.active', backgroundColor: theme.palette.action.active,
}, },
'&:focus': { '&:focus': {
'@media (hover: none)': { '@media (hover: none)': {
backgroundColor: 'transparent', backgroundColor: 'transparent',
}, },
backgroundColor: 'action.hover', backgroundColor: theme.palette.action.hover,
textDecoration: 'none', textDecoration: 'none',
// Reset on touch devices, it doesn't add specificity // Reset on touch devices, it doesn't add specificity
}, },
...@@ -39,7 +42,7 @@ function TabButton({ t, value, ...tabProps }) { ...@@ -39,7 +42,7 @@ function TabButton({ t, value, ...tabProps }) {
'@media (hover: none)': { '@media (hover: none)': {
backgroundColor: 'transparent', backgroundColor: 'transparent',
}, },
backgroundColor: 'action.hover', backgroundColor: theme.palette.action.hover,
textDecoration: 'none', textDecoration: 'none',
// Reset on touch devices, it doesn't add specificity // Reset on touch devices, it doesn't add specificity
}, },
...@@ -47,7 +50,15 @@ function TabButton({ t, value, ...tabProps }) { ...@@ -47,7 +50,15 @@ function TabButton({ t, value, ...tabProps }) {
minWidth: 'auto', minWidth: 'auto',
}, },
fill: 'currentcolor', fill: 'currentcolor',
}} }));
/** */
function TabButton({ t, value, ...tabProps }) {
return (
<Tooltip title={t('openCompanionWindow', { context: value })}>
<StyledTabButton
{...tabProps}
value={value}
aria-label={ aria-label={
t('openCompanionWindow', { context: value }) t('openCompanionWindow', { context: value })
} }
...@@ -102,15 +113,7 @@ export class WindowSideBarButtons extends Component { ...@@ -102,15 +113,7 @@ export class WindowSideBarButtons extends Component {
} = this.props; } = this.props;
return ( return (
<Tabs <Root
sx={{
'& .MuiTabs-flexContainer': {
flexDirection: 'column',
},
'&.MuiTabs-indicator': {
display: 'none',
},
}}
value={sideBarPanel === 'closed' ? false : sideBarPanel} value={sideBarPanel === 'closed' ? false : sideBarPanel}
onChange={this.handleChange} onChange={this.handleChange}
variant="fullWidth" variant="fullWidth"
...@@ -190,7 +193,7 @@ export class WindowSideBarButtons extends Component { ...@@ -190,7 +193,7 @@ export class WindowSideBarButtons extends Component {
icon={<PluginComponent />} icon={<PluginComponent />}
/> />
))} ))}
</Tabs> </Root>
); );
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment