Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(core): some ui style issues (#5995)

Peng Xiaoe2a31ea1fc02
diff --git a/packages/frontend/core/src/components/affine/page-history-modal/styles.css.ts b/packages/frontend/core/src/components/affine/page-history-modal/styles.css.ts
index 167194a7a9..8f781abd33 100644
--- a/packages/frontend/core/src/components/affine/page-history-modal/styles.css.ts
+++ b/packages/frontend/core/src/components/affine/page-history-modal/styles.css.ts
@@ -5,6 +5,7 @@ import { range } from 'lodash-es';
const headerHeight = createVar('header-height');
const footerHeight = createVar('footer-height');
const historyListWidth = createVar('history-list-width');
+const previewTopOffset = createVar('preview-top-offset');
export const root = style({
height: '100%',
width: '100%',
@@ -12,6 +13,7 @@ export const root = style({
[headerHeight]: '52px',
[footerHeight]: '68px',
[historyListWidth]: '240px',
+ [previewTopOffset]: '40px',
},
});
export const modalContent = style({
@@ -58,7 +60,7 @@ export const previewContainer = style({
range(-20, 20).map(i => [
`&[data-distance="${i}"]`,
{
- transform: `scale(${1 - 0.05 * i}) translateY(${-8 * i + 40}px)`,
+ transform: `scale(${1 - 0.05 * i}) translateY(calc(${-8 * i}px + ${previewTopOffset}))`,
opacity: [0, 1, 2].includes(i) ? 1 : 0,
zIndex: -i,
pointerEvents: i === 0 ? 'auto' : 'none',
@@ -66,13 +68,13 @@ export const previewContainer = style({
])
),
'&[data-distance="> 20"]': {
- transform: `scale(0) translateY(${-8 * 20 + 40}px)`,
+ transform: `scale(0) translateY(calc(${-8 * 20}px + ${previewTopOffset}))`,
opacity: 0,
zIndex: -20,
pointerEvents: 'none',
},
'&[data-distance="< -20"]': {
- transform: `scale(2) translateY(${-8 * -20 + 40}px)`,
+ transform: `scale(2) translateY(calc(${-8 * -20}px + ${previewTopOffset}))`,
opacity: 0,
zIndex: 20,
pointerEvents: 'none',
@@ -81,7 +83,7 @@ export const previewContainer = style({
});
export const previewContent = style({
- height: '50%',
+ height: `calc(50% - ${previewTopOffset} - ${headerHeight})`,
});
export const previewHeader = style({
@@ -168,7 +170,7 @@ export const historyListScrollableInner = style({
export const historyListHeader = style({
display: 'flex',
alignItems: 'center',
- height: 52,
+ height: headerHeight,
borderBottom: `1px solid ${cssVar('borderColor')}`,
fontWeight: 'bold',
flexShrink: 0,
diff --git a/packages/frontend/core/src/components/affine/page-properties/styles.css.ts b/packages/frontend/core/src/components/affine/page-properties/styles.css.ts
index 79c3210c0e..1d3be9aff8 100644
--- a/packages/frontend/core/src/components/affine/page-properties/styles.css.ts
+++ b/packages/frontend/core/src/components/affine/page-properties/styles.css.ts
@@ -53,6 +53,14 @@ export const tableHeaderSecondaryRow = style({
fontWeight: 500,
padding: '0 6px',
gap: '8px',
+ height: 24,
+});
+
+export const tableHeaderCollapseButtonWrapper = style({
+ display: 'flex',
+ flex: 1,
+ justifyContent: 'flex-end',
+ cursor: 'pointer',
});
export const pageInfoDimmed = style({
diff --git a/packages/frontend/core/src/components/affine/page-properties/table.tsx b/packages/frontend/core/src/components/affine/page-properties/table.tsx
index 3d1a42ccce..3585d9a7b8 100644
--- a/packages/frontend/core/src/components/affine/page-properties/table.tsx
+++ b/packages/frontend/core/src/components/affine/page-properties/table.tsx
@@ -667,18 +667,21 @@ export const PagePropertiesTableHeader = ({
/>
</PagePropertiesSettingsPopup>
)}
- <div className={styles.spacer} />
<Collapsible.Trigger asChild role="button" onClick={handleCollapse}>
- <IconButton
- type="plain"
+ <div
+ className={styles.tableHeaderCollapseButtonWrapper}
data-testid="page-info-collapse"
- icon={
- <ToggleExpandIcon
- className={styles.collapsedIcon}
- data-collapsed={!open}
- />
- }
- />
+ >
+ <IconButton
+ type="plain"
+ icon={
+ <ToggleExpandIcon
+ className={styles.collapsedIcon}
+ data-collapsed={!open}
+ />
+ }
+ />
+ </div>
</Collapsible.Trigger>
</div>
</div>