fix(core): adjust editor settings preview style (#8146)

close PD-1680 PD-1682 PD-1683

https://github.com/user-attachments/assets/49ed9ffe-8e8f-403d-91a0-e42b7f4ffb04
This commit is contained in:
JimmFly 2024-09-06 10:06:19 +00:00
parent cd5c512a5f
commit 7fe8d7e96f
No known key found for this signature in database
GPG Key ID: 126E0320FEB0D05C
4 changed files with 54 additions and 13 deletions

View File

@ -178,6 +178,7 @@ export const NoteSettings = () => {
docName="note"
keyName="affine:note"
getElements={getElements}
height={240}
/>
<SettingRow
name={t[

View File

@ -35,7 +35,12 @@ import { useFramework, useLiveData } from '@toeverything/infra';
import { useCallback, useMemo, useState } from 'react';
import { DropdownMenu } from '../menu';
import { menuTrigger, settingWrapper, shapeIndicator } from '../style.css';
import {
menuTrigger,
preViewLabelWrapper,
settingWrapper,
shapeIndicator,
} from '../style.css';
import { useColor } from '../utils';
import type { DocName } from './docs';
import { Point } from './point';
@ -206,7 +211,12 @@ export const ShapeSettings = () => {
};
const isSelected = fillColor === value;
return (
<MenuItem key={name} onSelect={handler} selected={isSelected}>
<MenuItem
key={name}
onSelect={handler}
selected={isSelected}
prefix={<Point color={value} />}
>
{name}
</MenuItem>
);
@ -221,7 +231,12 @@ export const ShapeSettings = () => {
};
const isSelected = strokeColor === value;
return (
<MenuItem key={name} onSelect={handler} selected={isSelected}>
<MenuItem
key={name}
onSelect={handler}
selected={isSelected}
prefix={<Point color={value} />}
>
{name}
</MenuItem>
);
@ -306,7 +321,12 @@ export const ShapeSettings = () => {
};
const isSelected = color === value;
return (
<MenuItem key={name} onSelect={handler} selected={isSelected}>
<MenuItem
key={name}
onSelect={handler}
selected={isSelected}
prefix={<Point color={value} />}
>
{name}
</MenuItem>
);
@ -373,20 +393,15 @@ export const ShapeSettings = () => {
firstUpdate={firstUpdate}
>
<RadioGroup
padding={0}
gap={4}
itemHeight={28}
borderRadius={8}
value={currentDoc}
items={docs}
onChange={setCurrentDoc}
style={{
background: 'transparent',
position: 'absolute',
right: 0,
bottom: 0,
right: '10px',
bottom: '10px',
}}
indicatorClassName={shapeIndicator}
className={preViewLabelWrapper}
/>
</EdgelessSnapshot>

View File

@ -12,7 +12,7 @@ import { isEqual } from 'lodash-es';
import { useCallback, useEffect, useRef } from 'react';
import { map, pairwise } from 'rxjs';
import { snapshotContainer, snapshotTitle } from '../style.css';
import { snapshotContainer, snapshotLabel, snapshotTitle } from '../style.css';
import { type DocName, getDocByName } from './docs';
import { getFrameBlock } from './utils';
@ -126,6 +126,7 @@ export const EdgelessSnapshot = (props: Props) => {
return (
<div className={snapshotContainer}>
<div className={snapshotTitle}>{title}</div>
<div className={snapshotLabel}>{title}</div>
<div
ref={wrapperRef}
style={{

View File

@ -8,6 +8,13 @@ export const settingWrapper = style({
minWidth: '150px',
maxWidth: '250px',
});
export const preViewLabelWrapper = style({
flexGrow: 1,
display: 'flex',
justifyContent: 'flex-end',
minWidth: '100px',
maxWidth: '250px',
});
export const menu = style({
background: 'white',
@ -46,6 +53,23 @@ export const snapshot = style({
alignItems: 'center',
});
export const snapshotLabel = style({
position: 'absolute',
bottom: '12px',
left: '50%',
transform: 'translateX(-50%)',
fontSize: cssVar('fontXs'),
color: cssVarV2('text/secondary'),
backgroundColor: cssVarV2('layer/background/hoverOverlay'),
padding: '2px 8px',
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
borderRadius: '4px',
zIndex: 1,
height: '24px',
});
export const shapeIndicator = style({
boxShadow: 'none',
backgroundColor: cssVarV2('layer/background/tertiary'),