Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull WorkspaceControlPanel styles up #3839

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 30 additions & 27 deletions src/components/WorkspaceControlPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,30 @@ import WorkspaceControlPanelButtons from '../containers/WorkspaceControlPanelBut
import Branding from '../containers/Branding';
import ns from '../config/css-ns';

const StyledWorkspaceButtons = styled('div')(({ theme }) => ({
const Root = styled(AppBar, { name: 'WorkspaceControlPanel', slot: 'root' })(({ ownerState, theme }) => ({
height: 64,
[theme.breakpoints.up('sm')]: {
height: '100%',
left: 0,
right: 'auto',
width: ownerState.variant === 'wide' ? 'auto' : 64,
},
...(ownerState.variant === 'wide' && {
width: 'auto',
}),
}));

const StyledToolbar = styled(Toolbar, { name: 'WorkspaceControlPanel', slot: 'toolbar' })(({ theme }) => ({
display: 'flex',
justifyContent: 'space-between',
[theme.breakpoints.up('sm')]: {
flexDirection: 'column',
justifyContent: 'flex-start',
minHeight: 0,
},
}));

const StyledWorkspaceButtons = styled('div', { name: 'WorkspaceControlPanel', slot: 'buttonArea' })(({ theme }) => ({
[theme.breakpoints.up('sm')]: {
display: 'flex',
flexDirection: 'column',
Expand All @@ -19,7 +42,7 @@ const StyledWorkspaceButtons = styled('div')(({ theme }) => ({
},
}));

const StyledBranding = styled(Branding)(({ theme }) => ({
const StyledBranding = styled(Branding, { name: 'WorkspaceControlPanel', slot: 'branding' })(({ theme }) => ({
display: 'flex',
position: 'absolute',
[theme.breakpoints.up('xs')]: {
Expand All @@ -46,45 +69,25 @@ export class WorkspaceControlPanel extends Component {
render() {
const { t, variant } = this.props;
return (
<AppBar
sx={(theme) => ({
height: 64,
[theme.breakpoints.up('sm')]: {
height: '100%',
left: 0,
right: 'auto',
width: variant === 'wide' ? 'auto' : 64,
},
...(variant === 'wide' && {
width: 'auto',
}),
})}
<Root
ownerState={this.props}
className={classNames(ns('workspace-control-panel'))}
color="default"
enableColorOnDark
position="absolute"
component="nav"
aria-label={t('workspaceNavigation')}
>
<Toolbar
<StyledToolbar
disableGutters
sx={(theme) => ({
display: 'flex',
justifyContent: 'space-between',
[theme.breakpoints.up('sm')]: {
flexDirection: 'column',
justifyContent: 'flex-start',
minHeight: 0,
},
})}
>
<WorkspaceAddButton />
<StyledWorkspaceButtons>
<WorkspaceControlPanelButtons />
</StyledWorkspaceButtons>
</Toolbar>
</StyledToolbar>
<StyledBranding t={t} variant={variant} />
</AppBar>
</Root>
);
}
}
Expand Down