fix: give electron app with minWidth = 640px (#1785)

This commit is contained in:
Peng Xiao
2023-04-03 15:20:58 +08:00
committed by GitHub
parent 487ef35563
commit 2cf8ab434e
10 changed files with 131 additions and 89 deletions
@@ -152,7 +152,7 @@ export const PageList: React.FC<PageListProps> = ({
{list.map((pageMeta, index) => {
return (
<StyledTableRow
data-testid={`page-list-item-${pageMeta.id}}`}
data-testid={`page-list-item-${pageMeta.id}`}
key={`${pageMeta.id}-${index}`}
>
<TableCell
@@ -5,8 +5,9 @@ export const StyledTableContainer = styled('div')(({ theme }) => {
return {
height: 'calc(100vh - 52px)',
padding: '78px 72px',
maxWidth: '100%',
overflowY: 'auto',
[theme.breakpoints.down('sm')]: {
[theme.breakpoints.down('md')]: {
padding: '12px 24px',
},
};
@@ -4,7 +4,10 @@ import type { HTMLAttributes, PropsWithChildren } from 'react';
import type React from 'react';
import { forwardRef, useEffect, useMemo, useState } from 'react';
import { useSidebarStatus } from '../../../hooks/affine/use-sidebar-status';
import {
useSidebarFloating,
useSidebarStatus,
} from '../../../hooks/affine/use-sidebar-status';
import { SidebarSwitch } from '../../affine/sidebar-switch';
import { EditorOptionMenu } from './header-right-items/EditorOptionMenu';
import SyncUser from './header-right-items/SyncUser';
@@ -66,10 +69,16 @@ export const Header = forwardRef<
setShowWarning(shouldShowWarning());
}, []);
const [open] = useSidebarStatus();
const sidebarFloating = useSidebarFloating();
const { t } = useTranslation();
return (
<StyledHeaderContainer ref={ref} hasWarning={showWarning} {...props}>
<StyledHeaderContainer
sidebarFloating={sidebarFloating && open}
ref={ref}
hasWarning={showWarning}
{...props}
>
<BrowserWarning
show={showWarning}
onClose={() => {
@@ -7,7 +7,8 @@ import {
export const StyledHeaderContainer = styled('div')<{
hasWarning: boolean;
}>(({ theme, hasWarning }) => {
sidebarFloating: boolean;
}>(({ theme, hasWarning, sidebarFloating }) => {
return {
height: hasWarning ? '96px' : '52px',
flexShrink: 0,
@@ -15,7 +16,7 @@ export const StyledHeaderContainer = styled('div')<{
top: 0,
background: theme.colors.pageBackground,
zIndex: 1,
WebkitAppRegion: 'drag',
WebkitAppRegion: sidebarFloating ? '' : 'drag',
button: {
WebkitAppRegion: 'no-drag',
},