fix(core): adjust sidebar workspace card syncing tooltip style (#6356)
This commit is contained in:
@@ -4,6 +4,7 @@ import type {
|
|||||||
TooltipProps as RootProps,
|
TooltipProps as RootProps,
|
||||||
} from '@radix-ui/react-tooltip';
|
} from '@radix-ui/react-tooltip';
|
||||||
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
||||||
|
import clsx from 'clsx';
|
||||||
import type { ReactElement, ReactNode } from 'react';
|
import type { ReactElement, ReactNode } from 'react';
|
||||||
|
|
||||||
import * as styles from './styles.css';
|
import * as styles from './styles.css';
|
||||||
@@ -32,6 +33,7 @@ export const Tooltip = ({
|
|||||||
if (!content) {
|
if (!content) {
|
||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
const { className, ...contentOptions } = options || {};
|
||||||
return (
|
return (
|
||||||
<TooltipPrimitive.Provider>
|
<TooltipPrimitive.Provider>
|
||||||
<TooltipPrimitive.Root delayDuration={500} {...rootOptions}>
|
<TooltipPrimitive.Root delayDuration={500} {...rootOptions}>
|
||||||
@@ -39,12 +41,12 @@ export const Tooltip = ({
|
|||||||
|
|
||||||
<TooltipPrimitive.Portal {...portalOptions}>
|
<TooltipPrimitive.Portal {...portalOptions}>
|
||||||
<TooltipPrimitive.Content
|
<TooltipPrimitive.Content
|
||||||
className={styles.tooltipContent}
|
className={clsx(styles.tooltipContent, className)}
|
||||||
side={side}
|
side={side}
|
||||||
align={align}
|
align={align}
|
||||||
sideOffset={5}
|
sideOffset={5}
|
||||||
style={{ zIndex: 'var(--affine-z-index-popover)' }}
|
style={{ zIndex: 'var(--affine-z-index-popover)' }}
|
||||||
{...options}
|
{...contentOptions}
|
||||||
>
|
>
|
||||||
{content}
|
{content}
|
||||||
<TooltipPrimitive.Arrow
|
<TooltipPrimitive.Arrow
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import {
|
|||||||
UnsyncIcon,
|
UnsyncIcon,
|
||||||
} from '@blocksuite/icons';
|
} from '@blocksuite/icons';
|
||||||
import { useService, Workspace } from '@toeverything/infra';
|
import { useService, Workspace } from '@toeverything/infra';
|
||||||
|
import { cssVar } from '@toeverything/theme';
|
||||||
import { useSetAtom } from 'jotai';
|
import { useSetAtom } from 'jotai';
|
||||||
import { debounce } from 'lodash-es';
|
import { debounce } from 'lodash-es';
|
||||||
import type { HTMLAttributes } from 'react';
|
import type { HTMLAttributes } from 'react';
|
||||||
@@ -59,7 +60,7 @@ const LocalWorkspaceStatus = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{!environment.isDesktop ? (
|
{!environment.isDesktop ? (
|
||||||
<InformationFillDuotoneIcon data-warning-color="true" />
|
<InformationFillDuotoneIcon style={{ color: cssVar('errorColor') }} />
|
||||||
) : (
|
) : (
|
||||||
<LocalWorkspaceIcon />
|
<LocalWorkspaceIcon />
|
||||||
)}
|
)}
|
||||||
@@ -234,7 +235,10 @@ const WorkspaceInfo = ({ name }: { name: string }) => {
|
|||||||
|
|
||||||
{/* when syncing/offline/... */}
|
{/* when syncing/offline/... */}
|
||||||
<div className={styles.workspaceInfo} data-type="events">
|
<div className={styles.workspaceInfo} data-type="events">
|
||||||
<Tooltip content={message}>
|
<Tooltip
|
||||||
|
content={message}
|
||||||
|
options={{ className: styles.workspaceInfoTooltip }}
|
||||||
|
>
|
||||||
<div className={styles.workspaceActiveStatus}>
|
<div className={styles.workspaceActiveStatus}>
|
||||||
<SyncingWorkspaceStatus progress={progress} />
|
<SyncingWorkspaceStatus progress={progress} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -96,4 +96,12 @@ export const workspaceActiveStatus = style({
|
|||||||
globalStyle(`.${workspaceActiveStatus} svg`, {
|
globalStyle(`.${workspaceActiveStatus} svg`, {
|
||||||
width: 16,
|
width: 16,
|
||||||
height: 16,
|
height: 16,
|
||||||
|
color: cssVar('iconSecondary'),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const workspaceInfoTooltip = style({
|
||||||
|
fontSize: cssVar('fontXs'),
|
||||||
|
lineHeight: '20px',
|
||||||
|
padding: '0 8px',
|
||||||
|
minHeight: 20,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
import { displayFlex, styled, textEllipsis } from '@affine/component';
|
|
||||||
import { cssVar } from '@toeverything/theme';
|
|
||||||
export const StyledSelectorContainer = styled('div')({
|
|
||||||
height: '50px',
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
padding: '0 6px',
|
|
||||||
borderRadius: '8px',
|
|
||||||
outline: 'none',
|
|
||||||
width: 'fit-content',
|
|
||||||
maxWidth: '100%',
|
|
||||||
color: cssVar('textPrimaryColor'),
|
|
||||||
':hover': {
|
|
||||||
cursor: 'pointer',
|
|
||||||
background: cssVar('hoverColor'),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export const StyledSelectorWrapper = styled('div')(() => {
|
|
||||||
return {
|
|
||||||
marginLeft: '8px',
|
|
||||||
flexGrow: 1,
|
|
||||||
overflow: 'hidden',
|
|
||||||
};
|
|
||||||
});
|
|
||||||
export const StyledWorkspaceName = styled('div')(() => {
|
|
||||||
return {
|
|
||||||
fontSize: cssVar('fontSm'),
|
|
||||||
lineHeight: '22px',
|
|
||||||
fontWeight: 500,
|
|
||||||
userSelect: 'none',
|
|
||||||
...textEllipsis(1),
|
|
||||||
marginLeft: '4px',
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
export const StyledWorkspaceStatus = styled('div')(() => {
|
|
||||||
return {
|
|
||||||
height: '22px',
|
|
||||||
...displayFlex('flex-start', 'center'),
|
|
||||||
fontSize: cssVar('fontXs'),
|
|
||||||
color: cssVar('black50'),
|
|
||||||
userSelect: 'none',
|
|
||||||
padding: '0 4px',
|
|
||||||
gap: '4px',
|
|
||||||
zIndex: '1',
|
|
||||||
svg: {
|
|
||||||
color: cssVar('iconSecondary'),
|
|
||||||
'&[data-warning-color="true"]': {
|
|
||||||
color: cssVar('errorColor'),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user