feat(core): adjust doc property style (#8561)
This commit is contained in:
@@ -15,10 +15,12 @@ export const BUILT_IN_CUSTOM_PROPERTY_TYPE = [
|
|||||||
id: 'docPrimaryMode',
|
id: 'docPrimaryMode',
|
||||||
type: 'docPrimaryMode',
|
type: 'docPrimaryMode',
|
||||||
show: 'always-hide',
|
show: 'always-hide',
|
||||||
|
index: 'a0000002',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'journal',
|
id: 'journal',
|
||||||
type: 'journal',
|
type: 'journal',
|
||||||
show: 'always-hide',
|
show: 'always-hide',
|
||||||
|
index: 'a0000003',
|
||||||
},
|
},
|
||||||
] as DocCustomPropertyInfo[];
|
] as DocCustomPropertyInfo[];
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ export const hide = style({
|
|||||||
export const propertyNameContainer = style({
|
export const propertyNameContainer = style({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
justifyContent: 'center',
|
justifyContent: 'start',
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
borderRadius: 4,
|
borderRadius: 4,
|
||||||
fontSize: cssVar('fontSm'),
|
fontSize: cssVar('fontSm'),
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ const PropertyItem = ({
|
|||||||
<MoreHorizontalIcon />
|
<MoreHorizontalIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Menu>
|
</Menu>
|
||||||
<DropIndicator edge={closestEdge} />
|
<DropIndicator edge={closestEdge} noTerminal />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ export const tableBodySortable = style({
|
|||||||
export const actionContainer = style({
|
export const actionContainer = style({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
gap: 8,
|
paddingTop: '2px',
|
||||||
selectors: {
|
selectors: {
|
||||||
[`[data-property-collapsed="true"] &`]: {
|
[`[data-property-collapsed="true"] &`]: {
|
||||||
display: 'none',
|
display: 'none',
|
||||||
@@ -157,13 +157,15 @@ export const actionContainer = style({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const propertyActionButton = style({
|
export const propertyActionButton = style({
|
||||||
alignSelf: 'flex-start',
|
|
||||||
fontSize: cssVar('fontSm'),
|
fontSize: cssVar('fontSm'),
|
||||||
color: `${cssVarV2('text/secondary')}`,
|
color: `${cssVarV2('text/secondary')}`,
|
||||||
padding: '0 6px',
|
padding: '0 6px',
|
||||||
height: 36,
|
height: 34,
|
||||||
fontWeight: 400,
|
fontWeight: 400,
|
||||||
gap: 6,
|
gap: 6,
|
||||||
|
width: '160px',
|
||||||
|
borderRadius: '4px',
|
||||||
|
justifyContent: 'start',
|
||||||
'@media': {
|
'@media': {
|
||||||
print: {
|
print: {
|
||||||
display: 'none',
|
display: 'none',
|
||||||
|
|||||||
@@ -21,6 +21,13 @@ import { TextValue } from './text';
|
|||||||
import type { PropertyValueProps } from './types';
|
import type { PropertyValueProps } from './types';
|
||||||
|
|
||||||
export const DocPropertyTypes = {
|
export const DocPropertyTypes = {
|
||||||
|
tags: {
|
||||||
|
icon: TagIcon,
|
||||||
|
value: TagsValue,
|
||||||
|
name: 'com.affine.page-properties.property.tags',
|
||||||
|
uniqueId: 'tags',
|
||||||
|
renameable: false,
|
||||||
|
},
|
||||||
text: {
|
text: {
|
||||||
icon: TextIcon,
|
icon: TextIcon,
|
||||||
value: TextValue,
|
value: TextValue,
|
||||||
@@ -31,16 +38,16 @@ export const DocPropertyTypes = {
|
|||||||
value: NumberValue,
|
value: NumberValue,
|
||||||
name: 'com.affine.page-properties.property.number',
|
name: 'com.affine.page-properties.property.number',
|
||||||
},
|
},
|
||||||
date: {
|
|
||||||
icon: DateTimeIcon,
|
|
||||||
value: DateValue,
|
|
||||||
name: 'com.affine.page-properties.property.date',
|
|
||||||
},
|
|
||||||
checkbox: {
|
checkbox: {
|
||||||
icon: CheckBoxCheckLinearIcon,
|
icon: CheckBoxCheckLinearIcon,
|
||||||
value: CheckboxValue,
|
value: CheckboxValue,
|
||||||
name: 'com.affine.page-properties.property.checkbox',
|
name: 'com.affine.page-properties.property.checkbox',
|
||||||
},
|
},
|
||||||
|
date: {
|
||||||
|
icon: DateTimeIcon,
|
||||||
|
value: DateValue,
|
||||||
|
name: 'com.affine.page-properties.property.date',
|
||||||
|
},
|
||||||
createdBy: {
|
createdBy: {
|
||||||
icon: CreatedEditedIcon,
|
icon: CreatedEditedIcon,
|
||||||
value: CreatedByValue,
|
value: CreatedByValue,
|
||||||
@@ -51,13 +58,6 @@ export const DocPropertyTypes = {
|
|||||||
value: UpdatedByValue,
|
value: UpdatedByValue,
|
||||||
name: 'com.affine.page-properties.property.updatedBy',
|
name: 'com.affine.page-properties.property.updatedBy',
|
||||||
},
|
},
|
||||||
tags: {
|
|
||||||
icon: TagIcon,
|
|
||||||
value: TagsValue,
|
|
||||||
name: 'com.affine.page-properties.property.tags',
|
|
||||||
uniqueId: 'tags',
|
|
||||||
renameable: false,
|
|
||||||
},
|
|
||||||
docPrimaryMode: {
|
docPrimaryMode: {
|
||||||
icon: FileIcon,
|
icon: FileIcon,
|
||||||
value: DocPrimaryModeValue,
|
value: DocPrimaryModeValue,
|
||||||
@@ -67,8 +67,6 @@ export const DocPropertyTypes = {
|
|||||||
icon: TodayIcon,
|
icon: TodayIcon,
|
||||||
value: JournalValue,
|
value: JournalValue,
|
||||||
name: 'com.affine.page-properties.property.journal',
|
name: 'com.affine.page-properties.property.journal',
|
||||||
uniqueId: 'journal',
|
|
||||||
renameable: false,
|
|
||||||
},
|
},
|
||||||
} as Record<
|
} as Record<
|
||||||
string,
|
string,
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { style } from '@vanilla-extract/css';
|
||||||
|
|
||||||
|
export const radioGroup = style({
|
||||||
|
// height: '28px',
|
||||||
|
});
|
||||||
|
|
||||||
|
export const container = style({
|
||||||
|
paddingTop: '3px',
|
||||||
|
paddingBottom: '3px',
|
||||||
|
});
|
||||||
@@ -9,6 +9,8 @@ import type { DocMode } from '@blocksuite/affine/blocks';
|
|||||||
import { DocService, useLiveData, useService } from '@toeverything/infra';
|
import { DocService, useLiveData, useService } from '@toeverything/infra';
|
||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
|
|
||||||
|
import * as styles from './doc-primary-mode.css';
|
||||||
|
|
||||||
export const DocPrimaryModeValue = () => {
|
export const DocPrimaryModeValue = () => {
|
||||||
const t = useI18n();
|
const t = useI18n();
|
||||||
const doc = useService(DocService).doc;
|
const doc = useService(DocService).doc;
|
||||||
@@ -46,12 +48,14 @@ export const DocPrimaryModeValue = () => {
|
|||||||
[doc, t]
|
[doc, t]
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<PropertyValue>
|
<PropertyValue className={styles.container}>
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
width={194}
|
width={194}
|
||||||
|
itemHeight={24}
|
||||||
value={primaryMode}
|
value={primaryMode}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
items={DocModeItems}
|
items={DocModeItems}
|
||||||
|
className={styles.radioGroup}
|
||||||
/>
|
/>
|
||||||
</PropertyValue>
|
</PropertyValue>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -120,9 +120,9 @@ test('property table reordering', async ({ page }) => {
|
|||||||
|
|
||||||
// new order should be Doc mode, (Tags), Number, Date, Checkbox, Text
|
// new order should be Doc mode, (Tags), Number, Date, Checkbox, Text
|
||||||
for (const [index, property] of [
|
for (const [index, property] of [
|
||||||
'Journal',
|
|
||||||
'Doc mode',
|
|
||||||
'Tags',
|
'Tags',
|
||||||
|
'Doc mode',
|
||||||
|
'Journal',
|
||||||
'Number',
|
'Number',
|
||||||
'Date',
|
'Date',
|
||||||
'Checkbox',
|
'Checkbox',
|
||||||
@@ -160,9 +160,9 @@ test('page info show more will show all properties', async ({ page }) => {
|
|||||||
await page.click('[data-testid="property-collapsible-button"]');
|
await page.click('[data-testid="property-collapsible-button"]');
|
||||||
|
|
||||||
for (const [index, property] of [
|
for (const [index, property] of [
|
||||||
'Journal',
|
|
||||||
'Doc mode',
|
|
||||||
'Tags',
|
'Tags',
|
||||||
|
'Doc mode',
|
||||||
|
'Journal',
|
||||||
'Text',
|
'Text',
|
||||||
'Number',
|
'Number',
|
||||||
'Date',
|
'Date',
|
||||||
|
|||||||
Reference in New Issue
Block a user