mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-18 02:26:21 +08:00
refactor: header options menu (#3615)
This commit is contained in:
+3
-5
@@ -14,21 +14,19 @@ const StyledIconButtonWithAnimate = styled(IconButton)(() => {
|
||||
svg: {
|
||||
transform: 'translateY(3px)',
|
||||
},
|
||||
'::after': {
|
||||
background: 'var(--affine-background-primary-color)',
|
||||
},
|
||||
backgroundColor: 'transparent !important',
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
// fixme(himself65): need to refactor
|
||||
export const QuickSearchButton = ({
|
||||
export const HeaderDropDownButton = ({
|
||||
onClick,
|
||||
...props
|
||||
}: Omit<IconButtonProps, 'children'>) => {
|
||||
return (
|
||||
<StyledIconButtonWithAnimate
|
||||
data-testid="header-quickSearchButton"
|
||||
data-testid="header-dropDownButton"
|
||||
{...props}
|
||||
onClick={e => {
|
||||
onClick?.(e);
|
||||
@@ -1,45 +1,19 @@
|
||||
import { RadioButton, RadioButtonGroup } from '@affine/component';
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
import { useSetAtom } from 'jotai';
|
||||
import { useAtom } from 'jotai';
|
||||
import type { ReactNode } from 'react';
|
||||
import type React from 'react';
|
||||
|
||||
import {
|
||||
allPageModeSelectAtom,
|
||||
openQuickSearchModalAtom,
|
||||
} from '../../../atoms';
|
||||
import { allPageModeSelectAtom } from '../../../atoms';
|
||||
import type { HeaderProps } from '../../blocksuite/workspace-header/header';
|
||||
import { Header } from '../../blocksuite/workspace-header/header';
|
||||
import * as styles from '../../blocksuite/workspace-header/styles.css';
|
||||
import { QuickSearchButton } from '../quick-search-button';
|
||||
|
||||
export interface WorkspaceTitleProps
|
||||
extends React.PropsWithChildren<HeaderProps> {
|
||||
icon?: ReactNode;
|
||||
}
|
||||
|
||||
export const WorkspaceTitle = ({
|
||||
icon,
|
||||
children,
|
||||
...props
|
||||
}: WorkspaceTitleProps) => {
|
||||
const setOpenQuickSearch = useSetAtom(openQuickSearchModalAtom);
|
||||
return (
|
||||
<Header {...props}>
|
||||
<div className={styles.pageListTitleWrapper}>
|
||||
<div className={styles.pageListTitleIcon}>{icon}</div>
|
||||
{children}
|
||||
<QuickSearchButton
|
||||
onClick={() => {
|
||||
setOpenQuickSearch(true);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Header>
|
||||
);
|
||||
};
|
||||
|
||||
export const WorkspaceModeFilterTab = ({ ...props }: WorkspaceTitleProps) => {
|
||||
const t = useAFFiNEI18N();
|
||||
const [value, setMode] = useAtom(allPageModeSelectAtom);
|
||||
|
||||
Reference in New Issue
Block a user