mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-30 11:23:42 +03:00
chore(mobile): adjust search back button and title style (#9125)
close AF-1827, AF-1826
This commit is contained in:
parent
7c2f0064ae
commit
300efa64ec
@ -19,6 +19,7 @@ export interface NavigationBackButtonProps extends IconButtonProps {
|
|||||||
export const NavigationBackButton = ({
|
export const NavigationBackButton = ({
|
||||||
icon,
|
icon,
|
||||||
backAction,
|
backAction,
|
||||||
|
children,
|
||||||
style: propsStyle,
|
style: propsStyle,
|
||||||
...otherProps
|
...otherProps
|
||||||
}: NavigationBackButtonProps) => {
|
}: NavigationBackButtonProps) => {
|
||||||
@ -42,6 +43,8 @@ export const NavigationBackButton = ({
|
|||||||
|
|
||||||
const style = useMemo(() => ({ padding: 10, ...propsStyle }), [propsStyle]);
|
const style = useMemo(() => ({ padding: 10, ...propsStyle }), [propsStyle]);
|
||||||
|
|
||||||
|
if (children) return children;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<IconButton
|
<IconButton
|
||||||
size={24}
|
size={24}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
|
Button,
|
||||||
SafeArea,
|
SafeArea,
|
||||||
startScopedViewTransition,
|
startScopedViewTransition,
|
||||||
useThemeColorV2,
|
useThemeColorV2,
|
||||||
@ -9,6 +10,7 @@ import {
|
|||||||
QuickSearchTagIcon,
|
QuickSearchTagIcon,
|
||||||
} from '@affine/core/modules/quicksearch';
|
} from '@affine/core/modules/quicksearch';
|
||||||
import { TagService } from '@affine/core/modules/tag';
|
import { TagService } from '@affine/core/modules/tag';
|
||||||
|
import { useI18n } from '@affine/i18n';
|
||||||
import { sleep } from '@blocksuite/affine/global/utils';
|
import { sleep } from '@blocksuite/affine/global/utils';
|
||||||
import { ViewLayersIcon } from '@blocksuite/icons/rc';
|
import { ViewLayersIcon } from '@blocksuite/icons/rc';
|
||||||
import {
|
import {
|
||||||
@ -17,6 +19,7 @@ import {
|
|||||||
useService,
|
useService,
|
||||||
useServices,
|
useServices,
|
||||||
} from '@toeverything/infra';
|
} from '@toeverything/infra';
|
||||||
|
import { bodyEmphasized } from '@toeverything/theme/typography';
|
||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -123,6 +126,7 @@ const WithQueryList = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const Component = () => {
|
export const Component = () => {
|
||||||
|
const t = useI18n();
|
||||||
useThemeColorV2('layer/background/mobile/primary');
|
useThemeColorV2('layer/background/mobile/primary');
|
||||||
const searchInput = useLiveData(searchInput$);
|
const searchInput = useLiveData(searchInput$);
|
||||||
const searchService = useService(MobileSearchService);
|
const searchService = useService(MobileSearchService);
|
||||||
@ -154,7 +158,6 @@ export const Component = () => {
|
|||||||
<>
|
<>
|
||||||
<SafeArea top>
|
<SafeArea top>
|
||||||
<div className={styles.searchHeader} data-testid="search-header">
|
<div className={styles.searchHeader} data-testid="search-header">
|
||||||
<NavigationBackButton backAction={transitionBack} />
|
|
||||||
<SearchInput
|
<SearchInput
|
||||||
className={styles.searchInput}
|
className={styles.searchInput}
|
||||||
debounce={300}
|
debounce={300}
|
||||||
@ -163,6 +166,15 @@ export const Component = () => {
|
|||||||
onInput={onSearch}
|
onInput={onSearch}
|
||||||
placeholder="Search Docs, Collections"
|
placeholder="Search Docs, Collections"
|
||||||
/>
|
/>
|
||||||
|
<NavigationBackButton>
|
||||||
|
<Button
|
||||||
|
variant="plain"
|
||||||
|
className={styles.searchCancel}
|
||||||
|
onClick={transitionBack}
|
||||||
|
>
|
||||||
|
<span className={bodyEmphasized}>{t['Cancel']()}</span>
|
||||||
|
</Button>
|
||||||
|
</NavigationBackButton>
|
||||||
</div>
|
</div>
|
||||||
</SafeArea>
|
</SafeArea>
|
||||||
{searchInput ? <WithQueryList /> : <RecentList />}
|
{searchInput ? <WithQueryList /> : <RecentList />}
|
||||||
|
@ -1,13 +1,21 @@
|
|||||||
import { footnoteRegular, title3Regular } from '@toeverything/theme/typography';
|
import {
|
||||||
|
bodyEmphasized,
|
||||||
|
footnoteRegular,
|
||||||
|
title3Regular,
|
||||||
|
} from '@toeverything/theme/typography';
|
||||||
import { cssVarV2 } from '@toeverything/theme/v2';
|
import { cssVarV2 } from '@toeverything/theme/v2';
|
||||||
import { style } from '@vanilla-extract/css';
|
import { style } from '@vanilla-extract/css';
|
||||||
|
|
||||||
export const searchHeader = style({
|
export const searchHeader = style({
|
||||||
padding: 16,
|
padding: 16,
|
||||||
paddingLeft: 8,
|
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
gap: 4,
|
gap: 12,
|
||||||
|
});
|
||||||
|
export const searchCancel = style({
|
||||||
|
height: 44,
|
||||||
|
padding: '0px 4px',
|
||||||
|
color: cssVarV2.button.primary,
|
||||||
});
|
});
|
||||||
export const searchInput = style({
|
export const searchInput = style({
|
||||||
width: 0,
|
width: 0,
|
||||||
@ -33,7 +41,7 @@ export const resBlock = style({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
export const resBlockTitle = style([
|
export const resBlockTitle = style([
|
||||||
title3Regular,
|
bodyEmphasized,
|
||||||
{
|
{
|
||||||
padding: '0 16px',
|
padding: '0 16px',
|
||||||
color: cssVarV2('text/primary'),
|
color: cssVarV2('text/primary'),
|
||||||
|
Loading…
Reference in New Issue
Block a user