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
4 changed files with 54 additions and 13 deletions

View File

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

View File

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

View File

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

View File

@@ -8,6 +8,13 @@ export const settingWrapper = style({
minWidth: '150px', minWidth: '150px',
maxWidth: '250px', maxWidth: '250px',
}); });
export const preViewLabelWrapper = style({
flexGrow: 1,
display: 'flex',
justifyContent: 'flex-end',
minWidth: '100px',
maxWidth: '250px',
});
export const menu = style({ export const menu = style({
background: 'white', background: 'white',
@@ -46,6 +53,23 @@ export const snapshot = style({
alignItems: 'center', 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({ export const shapeIndicator = style({
boxShadow: 'none', boxShadow: 'none',
backgroundColor: cssVarV2('layer/background/tertiary'), backgroundColor: cssVarV2('layer/background/tertiary'),