Skip to content

Commit

Permalink
chore: handle isWorkspaceDrawerOpen transform
Browse files Browse the repository at this point in the history
  • Loading branch information
orgrimarr authored and vraravam committed Aug 15, 2023
1 parent 4469e84 commit e901ed6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
17 changes: 16 additions & 1 deletion src/components/layout/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,21 @@ const styles = (theme: { workspaces: { drawer: { width: any } } }) => ({
// width: `calc(100% + ${theme.workspaces.drawer.width}px)`,
width: '100%',
transition,
},
appContentTransformTextWorkspace: {
transform() {
return workspaceStore.isWorkspaceDrawerOpen
? 'translateX(0)'
: `translateX(-${theme.workspaces.drawer.width}px)`;
},
},
appContentTransformIconWorkspace: {
transform() {
return workspaceStore.isWorkspaceDrawerOpen
? 'translateX(0)'
: `translateX(-75px)`;

Check failure on line 68 in src/components/layout/AppLayout.tsx

View workflow job for this annotation

GitHub Actions / macos

Strings must use singlequote

Check failure on line 68 in src/components/layout/AppLayout.tsx

View workflow job for this annotation

GitHub Actions / ubuntu

Strings must use singlequote

Check failure on line 68 in src/components/layout/AppLayout.tsx

View workflow job for this annotation

GitHub Actions / windows

Strings must use singlequote
},
},
titleBar: {
display: 'block',
zIndex: 1,
Expand Down Expand Up @@ -149,7 +158,13 @@ class AppLayout extends Component<PropsWithChildren<IProps>, IState> {
className={classes.titleBar}
/>
)}
<div className={`app__content ${classes.appContent}`}>
<div
className={`app__content ${classes.appContent} ${
settings.all.app.useWorkspaceDrawerIconStyle
? classes.appContentTransformIconWorkspace
: classes.appContentTransformTextWorkspace
}`}
>
{workspacesDrawer}
{sidebar}
<div className="app__service">
Expand Down
11 changes: 0 additions & 11 deletions src/features/appearance/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,15 +381,6 @@ function generateOpenWorkspaceStyle() {
`;
}

function generateWorkspaceWidthStyle(widthStr) {
const width = Number(widthStr);
return `
.drawerWithIconWidth {
width: ${width}
}
`;
}

function generateStyle(settings, app) {
let style = '';

Expand Down Expand Up @@ -428,8 +419,6 @@ function generateStyle(settings, app) {
isFullScreen,
);

style += generateWorkspaceWidthStyle(serviceRibbonWidth);

if (shouldShowDragArea) {
style += generateShowDragAreaStyle(accentColor);
}
Expand Down
5 changes: 4 additions & 1 deletion src/features/workspaces/components/WorkspaceDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ const styles = theme => ({
drawerWithText: {
width: `${theme.workspaces.drawer.width}px`,
},
drawerWithIcon: {
width: '75px',
},
headline: {
fontSize: '24px',
marginTop: '38px',
Expand Down Expand Up @@ -121,7 +124,7 @@ class WorkspaceDrawer extends Component<IProps> {
: activeWorkspace;

const drawerWithClass = useIconDisplayStyle
? 'drawerWithIconWidth'
? classes.drawerWithIcon
: classes.drawerWithText;
return (
<div className={`${classes.drawer} ${drawerWithClass} workspaces-drawer`}>
Expand Down

0 comments on commit e901ed6

Please sign in to comment.