mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-24 18:02:47 +08:00
fix: update breakpoint in all page (#2602)
This commit is contained in:
@@ -20,7 +20,7 @@ import { TrashOperationCell } from './operation-cell';
|
|||||||
import { StyledTableContainer, StyledTableRow } from './styles';
|
import { StyledTableContainer, StyledTableRow } from './styles';
|
||||||
import type { ListData, PageListProps, TrashListData } from './type';
|
import type { ListData, PageListProps, TrashListData } from './type';
|
||||||
import { useSorter } from './use-sorter';
|
import { useSorter } from './use-sorter';
|
||||||
import { formatDate } from './utils';
|
import { formatDate, useIsSmallDevices } from './utils';
|
||||||
|
|
||||||
const AllPagesHead = ({
|
const AllPagesHead = ({
|
||||||
isPublicWorkspace,
|
isPublicWorkspace,
|
||||||
@@ -121,8 +121,7 @@ export const PageList = ({
|
|||||||
order: 'desc',
|
order: 'desc',
|
||||||
});
|
});
|
||||||
|
|
||||||
const theme = useTheme();
|
const isSmallDevices = useIsSmallDevices();
|
||||||
const isSmallDevices = useMediaQuery(theme.breakpoints.down('sm'));
|
|
||||||
if (isSmallDevices) {
|
if (isSmallDevices) {
|
||||||
return (
|
return (
|
||||||
<AllPageListMobileView
|
<AllPageListMobileView
|
||||||
@@ -217,10 +216,8 @@ export const PageListTrashView: React.FC<{
|
|||||||
text={title || t['Untitled']()}
|
text={title || t['Untitled']()}
|
||||||
onClick={onClickPage}
|
onClick={onClickPage}
|
||||||
/>
|
/>
|
||||||
<TableCell ellipsis={true} onClick={onClickPage}>
|
<TableCell onClick={onClickPage}>{formatDate(createDate)}</TableCell>
|
||||||
{formatDate(createDate)}
|
<TableCell onClick={onClickPage}>
|
||||||
</TableCell>
|
|
||||||
<TableCell ellipsis={true} onClick={onClickPage}>
|
|
||||||
{trashDate ? formatDate(trashDate) : '--'}
|
{trashDate ? formatDate(trashDate) : '--'}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell
|
<TableCell
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { styled, TableBody, TableCell } from '@affine/component';
|
import { styled, TableBody, TableCell } from '@affine/component';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import { useDraggable } from '@dnd-kit/core';
|
import { useDraggable } from '@dnd-kit/core';
|
||||||
import { useMediaQuery, useTheme } from '@mui/material';
|
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import { Fragment } from 'react';
|
import { Fragment } from 'react';
|
||||||
|
|
||||||
@@ -11,7 +10,7 @@ import { OperationCell } from './operation-cell';
|
|||||||
import { StyledTableRow } from './styles';
|
import { StyledTableRow } from './styles';
|
||||||
import type { DateKey, DraggableTitleCellData, ListData } from './type';
|
import type { DateKey, DraggableTitleCellData, ListData } from './type';
|
||||||
import { useDateGroup } from './use-date-group';
|
import { useDateGroup } from './use-date-group';
|
||||||
import { formatDate } from './utils';
|
import { formatDate, useIsSmallDevices } from './utils';
|
||||||
|
|
||||||
export const GroupRow = ({ children }: { children: ReactNode }) => {
|
export const GroupRow = ({ children }: { children: ReactNode }) => {
|
||||||
return (
|
return (
|
||||||
@@ -40,8 +39,7 @@ export const AllPagesBody = ({
|
|||||||
groupKey?: DateKey;
|
groupKey?: DateKey;
|
||||||
}) => {
|
}) => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useAFFiNEI18N();
|
||||||
const theme = useTheme();
|
const isSmallDevices = useIsSmallDevices();
|
||||||
const isSmallDevices = useMediaQuery(theme.breakpoints.down('sm'));
|
|
||||||
const dataWithGroup = useDateGroup({ data, key: groupKey });
|
const dataWithGroup = useDateGroup({ data, key: groupKey });
|
||||||
return (
|
return (
|
||||||
<TableBody>
|
<TableBody>
|
||||||
|
|||||||
@@ -1,3 +1,11 @@
|
|||||||
|
import { useMediaQuery, useTheme } from '@mui/material';
|
||||||
|
|
||||||
|
export const useIsSmallDevices = () => {
|
||||||
|
const theme = useTheme();
|
||||||
|
const isSmallDevices = useMediaQuery(theme.breakpoints.down(900));
|
||||||
|
return isSmallDevices;
|
||||||
|
};
|
||||||
|
|
||||||
export function isToday(date: Date): boolean {
|
export function isToday(date: Date): boolean {
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export const StyledTableCell = styled('td')<
|
|||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
textAlign: align,
|
textAlign: align,
|
||||||
verticalAlign: 'middle',
|
verticalAlign: 'middle',
|
||||||
overflowWrap: 'break-word',
|
whiteSpace: 'nowrap',
|
||||||
userSelect: 'none',
|
userSelect: 'none',
|
||||||
fontSize: 'var(--affine-font-sm)',
|
fontSize: 'var(--affine-font-sm)',
|
||||||
...(active ? { color: 'var(--affine-text-primary-color)' } : {}),
|
...(active ? { color: 'var(--affine-text-primary-color)' } : {}),
|
||||||
|
|||||||
Reference in New Issue
Block a user