Skip to content

Commit

Permalink
🔧 Twaek headerbar layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Schneegans committed Jan 21, 2025
1 parent 2ee7444 commit 03f0379
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 16 deletions.
12 changes: 7 additions & 5 deletions src/settings-renderer/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,23 @@ export default () => {

const leftHeaderbar = (
<Headerbar
left={<img src={logo} width={20} style={{ verticalAlign: 'middle' }} />}
center={i18next.t('settings.title')}
right={headerButtons}
left={!cIsMac && <img src={logo} width={20} style={{ verticalAlign: 'middle' }} />}
right={!cIsMac && headerButtons}
paddingLeft={10}
paddingRight={5}
/>
);
const rightHeaderbar = <Headerbar />;
const centerHeaderbar = <Headerbar center={i18next.t('settings.title')} transparent />;
const rightHeaderbar = <Headerbar
right={cIsMac && headerButtons}
/>;

return (
<>
<div className={`${classes.container} ${transparent ? classes.transparent : ''}`}>
<Tooltip id="main-tooltip" delayShow={200} />
<Sidebar position="left" header={leftHeaderbar} content={<MenuList />} />
<Preview />
<Preview header={centerHeaderbar} />
<Sidebar position="right" header={rightHeaderbar} content={<Properties />} />
<GeneralSettingsDialog
visible={settingsVisible}
Expand Down
11 changes: 6 additions & 5 deletions src/settings-renderer/components/Headerbar.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@
@import '../variable.scss';

.headerbar {
background-color: $background-header;
color: $text-primary;
min-height: env(titlebar-area-height, 30);
-webkit-app-region: drag;
display: flex;
align-items: center;
justify-content: space-between;
gap: 5px;
}

.headerbar > :nth-child(2) {
flex-grow: 1;
white-space: nowrap;

&:not(.transparent) {
background-color: $background-header;
}
}

.noDrag {
Expand Down
3 changes: 2 additions & 1 deletion src/settings-renderer/components/Headerbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ interface IProps {
right?: string | ReactNode;
paddingLeft?: number;
paddingRight?: number;
transparent?: boolean;
}

export default (props: IProps) => {
return (
<div className={classes.headerbar}>
<div className={classes.headerbar + (props.transparent ? ' ' + classes.transparent : '')}>
<div
className={typeof props.left === 'string' ? '' : classes.noDrag}
style={{ paddingLeft: props.paddingLeft || 0 }}>
Expand Down
3 changes: 2 additions & 1 deletion src/settings-renderer/components/Modal.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
justify-content: center;
align-items: center;

backdrop-filter: blur(5px);

transition: opacity 300ms;
opacity: 0;
Expand All @@ -41,6 +40,8 @@
border-radius: 10px;
overflow: hidden;

box-shadow: 0 0 75px rgba(0, 0, 0, 0.4);

max-height: 80vh;
width: min(90vw, min(calc(200px + 50vw), 800px));

Expand Down
1 change: 0 additions & 1 deletion src/settings-renderer/components/Preview.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
// SPDX-License-Identifier: MIT

.preview {
-webkit-app-region: drag;
flex-grow: 1;
}
12 changes: 9 additions & 3 deletions src/settings-renderer/components/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@
// SPDX-FileCopyrightText: Simon Schneegans <[email protected]>
// SPDX-License-Identifier: MIT

import React from 'react';
import React, {ReactNode} from 'react';

import * as classes from './Preview.module.scss';

export default () => {
return <div className={classes.preview}></div>;
interface IProps {
header: ReactNode;
}

export default (props: IProps) => {
return <div className={classes.preview}>
{props.header}
</div>;
};

0 comments on commit 03f0379

Please sign in to comment.