mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-19 07:17:00 +08:00
fix(core): adjust ui styles (#5094)
This commit is contained in:
@@ -33,13 +33,14 @@ export const LanguageMenu = () => {
|
||||
contentOptions={{
|
||||
style: {
|
||||
background: 'var(--affine-white)',
|
||||
width: '250px',
|
||||
},
|
||||
align: 'end',
|
||||
}}
|
||||
>
|
||||
<MenuTrigger
|
||||
data-testid="language-menu-button"
|
||||
style={{ textTransform: 'capitalize', fontWeight: 600 }}
|
||||
style={{ textTransform: 'capitalize', fontWeight: 600, width: '250px' }}
|
||||
block={true}
|
||||
>
|
||||
{currentLanguage?.originalName || ''}
|
||||
|
||||
@@ -96,6 +96,8 @@ export const ProfilePanel = ({ workspace, isOwner }: ProfilePanelProps) => {
|
||||
[pushNotification, update]
|
||||
);
|
||||
|
||||
const canAdjustAvatar = workspaceAvatar && isOwner;
|
||||
|
||||
return (
|
||||
<div className={style.profileWrapper}>
|
||||
<Upload
|
||||
@@ -110,11 +112,15 @@ export const ProfilePanel = ({ workspace, isOwner }: ProfilePanelProps) => {
|
||||
name={name}
|
||||
colorfulFallback
|
||||
hoverIcon={isOwner ? <CameraIcon /> : undefined}
|
||||
onRemove={
|
||||
workspaceAvatar && isOwner ? handleRemoveUserAvatar : undefined
|
||||
onRemove={canAdjustAvatar ? 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"
|
||||
removeButtonProps={{
|
||||
['data-testid' as string]: 'workspace-setting-remove-avatar-button',
|
||||
|
||||
@@ -38,16 +38,20 @@ import {
|
||||
|
||||
export type UserInfoProps = {
|
||||
onAccountSettingClick: () => void;
|
||||
active?: boolean;
|
||||
};
|
||||
|
||||
export const UserInfo = ({
|
||||
onAccountSettingClick,
|
||||
active,
|
||||
}: UserInfoProps): ReactElement => {
|
||||
const user = useCurrentUser();
|
||||
return (
|
||||
<div
|
||||
data-testid="user-info-card"
|
||||
className={accountButton}
|
||||
className={clsx(accountButton, {
|
||||
active: active,
|
||||
})}
|
||||
onClick={onAccountSettingClick}
|
||||
>
|
||||
<Avatar size={28} name={user.name} url={user.image} className="avatar" />
|
||||
@@ -163,7 +167,10 @@ export const SettingSidebar = ({
|
||||
|
||||
{runtimeConfig.enableCloud && loginStatus === 'authenticated' ? (
|
||||
<Suspense>
|
||||
<UserInfo onAccountSettingClick={onAccountSettingClick} />
|
||||
<UserInfo
|
||||
onAccountSettingClick={onAccountSettingClick}
|
||||
active={selectedGeneralKey === 'account'}
|
||||
/>
|
||||
</Suspense>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
@@ -105,6 +105,11 @@ export const accountButton = style({
|
||||
':hover': {
|
||||
background: 'var(--affine-hover-color)',
|
||||
},
|
||||
selectors: {
|
||||
'&.active': {
|
||||
background: 'var(--affine-hover-color)',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
globalStyle(`${accountButton} .avatar`, {
|
||||
|
||||
@@ -112,9 +112,6 @@ export const radioButton = style({
|
||||
},
|
||||
},
|
||||
});
|
||||
export const spanStyle = style({
|
||||
padding: '4px 20px',
|
||||
});
|
||||
|
||||
export const disableSharePage = style({
|
||||
color: 'var(--affine-error-color)',
|
||||
|
||||
@@ -174,18 +174,10 @@ export const AffineSharePage = (props: ShareMenuProps) => {
|
||||
value={mode}
|
||||
onValueChange={onShareModeChange}
|
||||
>
|
||||
<RadioButton
|
||||
className={styles.radioButton}
|
||||
value={'page'}
|
||||
spanStyle={styles.spanStyle}
|
||||
>
|
||||
<RadioButton className={styles.radioButton} value={'page'}>
|
||||
{t['com.affine.pageMode.page']()}
|
||||
</RadioButton>
|
||||
<RadioButton
|
||||
className={styles.radioButton}
|
||||
value={'edgeless'}
|
||||
spanStyle={styles.spanStyle}
|
||||
>
|
||||
<RadioButton className={styles.radioButton} value={'edgeless'}>
|
||||
{t['com.affine.pageMode.edgeless']()}
|
||||
</RadioButton>
|
||||
</RadioButtonGroup>
|
||||
|
||||
@@ -32,6 +32,8 @@ export const titleInput = style({
|
||||
borderRadius: '8px',
|
||||
height: '32px',
|
||||
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 { allPageModeSelectAtom } from '../../../atoms';
|
||||
import * as styles from './index.css';
|
||||
|
||||
export const WorkspaceModeFilterTab = () => {
|
||||
const t = useAFFiNEI18N();
|
||||
@@ -15,16 +16,14 @@ export const WorkspaceModeFilterTab = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<RadioButtonGroup
|
||||
width={300}
|
||||
value={value}
|
||||
onValueChange={handleValueChange}
|
||||
>
|
||||
<RadioButton value="all" style={{ textTransform: 'capitalize' }}>
|
||||
<RadioButtonGroup value={value} onValueChange={handleValueChange}>
|
||||
<RadioButton value="all" spanStyle={styles.filterTab}>
|
||||
{t['com.affine.pageMode.all']()}
|
||||
</RadioButton>
|
||||
<RadioButton value="page">{t['com.affine.pageMode.page']()}</RadioButton>
|
||||
<RadioButton value="edgeless">
|
||||
<RadioButton spanStyle={styles.filterTab} value="page">
|
||||
{t['com.affine.pageMode.page']()}
|
||||
</RadioButton>
|
||||
<RadioButton spanStyle={styles.filterTab} value="edgeless">
|
||||
{t['com.affine.pageMode.edgeless']()}
|
||||
</RadioButton>
|
||||
</RadioButtonGroup>
|
||||
|
||||
@@ -118,6 +118,7 @@ const Placeholder = ({ collection }: { collection: Collection }) => {
|
||||
alignItems: 'center',
|
||||
gap: 8,
|
||||
padding: '12px 24px',
|
||||
fontSize: 'var(--affine-font-xs)',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
@@ -128,7 +129,10 @@ const Placeholder = ({ collection }: { collection: Collection }) => {
|
||||
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']()}
|
||||
<div>/</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user