mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-22 03:33:06 +08:00
fix(core): adjust ui styles (#5094)
This commit is contained in:
@@ -5,7 +5,7 @@ import type {
|
|||||||
} from '@affine/env/filter';
|
} from '@affine/env/filter';
|
||||||
import type { PropertiesMeta } from '@affine/env/filter';
|
import type { PropertiesMeta } from '@affine/env/filter';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import { FilteredIcon } from '@blocksuite/icons';
|
import { FilterIcon } from '@blocksuite/icons';
|
||||||
import { Button } from '@toeverything/components/button';
|
import { Button } from '@toeverything/components/button';
|
||||||
import { Menu } from '@toeverything/components/menu';
|
import { Menu } from '@toeverything/components/menu';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
@@ -75,7 +75,7 @@ export const CollectionList = ({
|
|||||||
<Button
|
<Button
|
||||||
className={styles.filterMenuTrigger}
|
className={styles.filterMenuTrigger}
|
||||||
type="default"
|
type="default"
|
||||||
icon={<FilteredIcon />}
|
icon={<FilterIcon />}
|
||||||
data-testid="create-first-filter"
|
data-testid="create-first-filter"
|
||||||
>
|
>
|
||||||
{t['com.affine.filter']()}
|
{t['com.affine.filter']()}
|
||||||
@@ -99,7 +99,7 @@ export const CollectionList = ({
|
|||||||
<Button
|
<Button
|
||||||
className={styles.filterMenuTrigger}
|
className={styles.filterMenuTrigger}
|
||||||
type="default"
|
type="default"
|
||||||
icon={<FilteredIcon />}
|
icon={<FilterIcon />}
|
||||||
data-testid="create-first-filter"
|
data-testid="create-first-filter"
|
||||||
>
|
>
|
||||||
{t['com.affine.filter']()}
|
{t['com.affine.filter']()}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ export const dropdownIcon = style({
|
|||||||
|
|
||||||
export const radioButton = style({
|
export const radioButton = style({
|
||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
|
flex: 1,
|
||||||
selectors: {
|
selectors: {
|
||||||
'&:not(:last-of-type)': {
|
'&:not(:last-of-type)': {
|
||||||
marginRight: '4px',
|
marginRight: '4px',
|
||||||
@@ -72,7 +73,8 @@ export const radioButtonContent = style({
|
|||||||
display: 'flex',
|
display: 'flex',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
height: '24px',
|
height: '28px',
|
||||||
|
padding: '4px 8px',
|
||||||
borderRadius: '8px',
|
borderRadius: '8px',
|
||||||
filter: 'drop-shadow(0px 0px 4px rgba(0, 0, 0, 0.1))',
|
filter: 'drop-shadow(0px 0px 4px rgba(0, 0, 0, 0.1))',
|
||||||
whiteSpace: 'nowrap',
|
whiteSpace: 'nowrap',
|
||||||
|
|||||||
@@ -33,13 +33,14 @@ export const LanguageMenu = () => {
|
|||||||
contentOptions={{
|
contentOptions={{
|
||||||
style: {
|
style: {
|
||||||
background: 'var(--affine-white)',
|
background: 'var(--affine-white)',
|
||||||
|
width: '250px',
|
||||||
},
|
},
|
||||||
align: 'end',
|
align: 'end',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<MenuTrigger
|
<MenuTrigger
|
||||||
data-testid="language-menu-button"
|
data-testid="language-menu-button"
|
||||||
style={{ textTransform: 'capitalize', fontWeight: 600 }}
|
style={{ textTransform: 'capitalize', fontWeight: 600, width: '250px' }}
|
||||||
block={true}
|
block={true}
|
||||||
>
|
>
|
||||||
{currentLanguage?.originalName || ''}
|
{currentLanguage?.originalName || ''}
|
||||||
|
|||||||
+10
-4
@@ -96,6 +96,8 @@ export const ProfilePanel = ({ workspace, isOwner }: ProfilePanelProps) => {
|
|||||||
[pushNotification, update]
|
[pushNotification, update]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const canAdjustAvatar = workspaceAvatar && isOwner;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={style.profileWrapper}>
|
<div className={style.profileWrapper}>
|
||||||
<Upload
|
<Upload
|
||||||
@@ -110,11 +112,15 @@ export const ProfilePanel = ({ workspace, isOwner }: ProfilePanelProps) => {
|
|||||||
name={name}
|
name={name}
|
||||||
colorfulFallback
|
colorfulFallback
|
||||||
hoverIcon={isOwner ? <CameraIcon /> : undefined}
|
hoverIcon={isOwner ? <CameraIcon /> : undefined}
|
||||||
onRemove={
|
onRemove={canAdjustAvatar ? handleRemoveUserAvatar : undefined}
|
||||||
workspaceAvatar && isOwner ? handleRemoveUserAvatar : undefined
|
avatarTooltipOptions={
|
||||||
|
canAdjustAvatar
|
||||||
|
? { content: t['Click to replace photo']() }
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
removeTooltipOptions={
|
||||||
|
canAdjustAvatar ? { content: t['Remove photo']() } : undefined
|
||||||
}
|
}
|
||||||
avatarTooltipOptions={{ content: t['Click to replace photo']() }}
|
|
||||||
removeTooltipOptions={{ content: t['Remove photo']() }}
|
|
||||||
data-testid="workspace-setting-avatar"
|
data-testid="workspace-setting-avatar"
|
||||||
removeButtonProps={{
|
removeButtonProps={{
|
||||||
['data-testid' as string]: 'workspace-setting-remove-avatar-button',
|
['data-testid' as string]: 'workspace-setting-remove-avatar-button',
|
||||||
|
|||||||
+9
-2
@@ -38,16 +38,20 @@ import {
|
|||||||
|
|
||||||
export type UserInfoProps = {
|
export type UserInfoProps = {
|
||||||
onAccountSettingClick: () => void;
|
onAccountSettingClick: () => void;
|
||||||
|
active?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const UserInfo = ({
|
export const UserInfo = ({
|
||||||
onAccountSettingClick,
|
onAccountSettingClick,
|
||||||
|
active,
|
||||||
}: UserInfoProps): ReactElement => {
|
}: UserInfoProps): ReactElement => {
|
||||||
const user = useCurrentUser();
|
const user = useCurrentUser();
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-testid="user-info-card"
|
data-testid="user-info-card"
|
||||||
className={accountButton}
|
className={clsx(accountButton, {
|
||||||
|
active: active,
|
||||||
|
})}
|
||||||
onClick={onAccountSettingClick}
|
onClick={onAccountSettingClick}
|
||||||
>
|
>
|
||||||
<Avatar size={28} name={user.name} url={user.image} className="avatar" />
|
<Avatar size={28} name={user.name} url={user.image} className="avatar" />
|
||||||
@@ -163,7 +167,10 @@ export const SettingSidebar = ({
|
|||||||
|
|
||||||
{runtimeConfig.enableCloud && loginStatus === 'authenticated' ? (
|
{runtimeConfig.enableCloud && loginStatus === 'authenticated' ? (
|
||||||
<Suspense>
|
<Suspense>
|
||||||
<UserInfo onAccountSettingClick={onAccountSettingClick} />
|
<UserInfo
|
||||||
|
onAccountSettingClick={onAccountSettingClick}
|
||||||
|
active={selectedGeneralKey === 'account'}
|
||||||
|
/>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+5
@@ -105,6 +105,11 @@ export const accountButton = style({
|
|||||||
':hover': {
|
':hover': {
|
||||||
background: 'var(--affine-hover-color)',
|
background: 'var(--affine-hover-color)',
|
||||||
},
|
},
|
||||||
|
selectors: {
|
||||||
|
'&.active': {
|
||||||
|
background: 'var(--affine-hover-color)',
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
globalStyle(`${accountButton} .avatar`, {
|
globalStyle(`${accountButton} .avatar`, {
|
||||||
|
|||||||
@@ -112,9 +112,6 @@ export const radioButton = style({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
export const spanStyle = style({
|
|
||||||
padding: '4px 20px',
|
|
||||||
});
|
|
||||||
|
|
||||||
export const disableSharePage = style({
|
export const disableSharePage = style({
|
||||||
color: 'var(--affine-error-color)',
|
color: 'var(--affine-error-color)',
|
||||||
|
|||||||
+2
-10
@@ -174,18 +174,10 @@ export const AffineSharePage = (props: ShareMenuProps) => {
|
|||||||
value={mode}
|
value={mode}
|
||||||
onValueChange={onShareModeChange}
|
onValueChange={onShareModeChange}
|
||||||
>
|
>
|
||||||
<RadioButton
|
<RadioButton className={styles.radioButton} value={'page'}>
|
||||||
className={styles.radioButton}
|
|
||||||
value={'page'}
|
|
||||||
spanStyle={styles.spanStyle}
|
|
||||||
>
|
|
||||||
{t['com.affine.pageMode.page']()}
|
{t['com.affine.pageMode.page']()}
|
||||||
</RadioButton>
|
</RadioButton>
|
||||||
<RadioButton
|
<RadioButton className={styles.radioButton} value={'edgeless'}>
|
||||||
className={styles.radioButton}
|
|
||||||
value={'edgeless'}
|
|
||||||
spanStyle={styles.spanStyle}
|
|
||||||
>
|
|
||||||
{t['com.affine.pageMode.edgeless']()}
|
{t['com.affine.pageMode.edgeless']()}
|
||||||
</RadioButton>
|
</RadioButton>
|
||||||
</RadioButtonGroup>
|
</RadioButtonGroup>
|
||||||
|
|||||||
+2
@@ -32,6 +32,8 @@ export const titleInput = style({
|
|||||||
borderRadius: '8px',
|
borderRadius: '8px',
|
||||||
height: '32px',
|
height: '32px',
|
||||||
padding: '6px 8px',
|
padding: '6px 8px',
|
||||||
|
borderColor: 'var(--affine-primary-color)',
|
||||||
|
boxShadow: 'var(--affine-active-shadow)',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import { style } from '@vanilla-extract/css';
|
||||||
|
|
||||||
|
export const filterTab = style({
|
||||||
|
fontSize: 'var(--affine-font-xs)',
|
||||||
|
fontWeight: 600,
|
||||||
|
textTransform: 'capitalize',
|
||||||
|
minWidth: '91px',
|
||||||
|
});
|
||||||
@@ -3,6 +3,7 @@ import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
|||||||
import { useAtom } from 'jotai';
|
import { useAtom } from 'jotai';
|
||||||
|
|
||||||
import { allPageModeSelectAtom } from '../../../atoms';
|
import { allPageModeSelectAtom } from '../../../atoms';
|
||||||
|
import * as styles from './index.css';
|
||||||
|
|
||||||
export const WorkspaceModeFilterTab = () => {
|
export const WorkspaceModeFilterTab = () => {
|
||||||
const t = useAFFiNEI18N();
|
const t = useAFFiNEI18N();
|
||||||
@@ -15,16 +16,14 @@ export const WorkspaceModeFilterTab = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RadioButtonGroup
|
<RadioButtonGroup value={value} onValueChange={handleValueChange}>
|
||||||
width={300}
|
<RadioButton value="all" spanStyle={styles.filterTab}>
|
||||||
value={value}
|
|
||||||
onValueChange={handleValueChange}
|
|
||||||
>
|
|
||||||
<RadioButton value="all" style={{ textTransform: 'capitalize' }}>
|
|
||||||
{t['com.affine.pageMode.all']()}
|
{t['com.affine.pageMode.all']()}
|
||||||
</RadioButton>
|
</RadioButton>
|
||||||
<RadioButton value="page">{t['com.affine.pageMode.page']()}</RadioButton>
|
<RadioButton spanStyle={styles.filterTab} value="page">
|
||||||
<RadioButton value="edgeless">
|
{t['com.affine.pageMode.page']()}
|
||||||
|
</RadioButton>
|
||||||
|
<RadioButton spanStyle={styles.filterTab} value="edgeless">
|
||||||
{t['com.affine.pageMode.edgeless']()}
|
{t['com.affine.pageMode.edgeless']()}
|
||||||
</RadioButton>
|
</RadioButton>
|
||||||
</RadioButtonGroup>
|
</RadioButtonGroup>
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ const Placeholder = ({ collection }: { collection: Collection }) => {
|
|||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
gap: 8,
|
gap: 8,
|
||||||
padding: '12px 24px',
|
padding: '12px 24px',
|
||||||
|
fontSize: 'var(--affine-font-xs)',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@@ -128,7 +129,10 @@ const Placeholder = ({ collection }: { collection: Collection }) => {
|
|||||||
color: 'var(--affine-text-secondary-color)',
|
color: 'var(--affine-text-secondary-color)',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ViewLayersIcon style={{ color: 'var(--affine-icon-color)' }} />
|
<ViewLayersIcon
|
||||||
|
style={{ color: 'var(--affine-icon-color)' }}
|
||||||
|
fontSize={14}
|
||||||
|
/>
|
||||||
{t['com.affine.collection.allCollections']()}
|
{t['com.affine.collection.allCollections']()}
|
||||||
<div>/</div>
|
<div>/</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user