mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-21 08:01:31 +03:00
feat(mobile): move journal date picker into page header (#8968)
This commit is contained in:
parent
1c9bd204cd
commit
372dbf5ec8
@ -44,6 +44,15 @@ export interface PageHeaderProps
|
|||||||
prefixStyle?: React.CSSProperties;
|
prefixStyle?: React.CSSProperties;
|
||||||
suffixClassName?: string;
|
suffixClassName?: string;
|
||||||
suffixStyle?: React.CSSProperties;
|
suffixStyle?: React.CSSProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom bottom content
|
||||||
|
*/
|
||||||
|
bottom?: ReactNode;
|
||||||
|
/**
|
||||||
|
* Bottom Spacer height
|
||||||
|
*/
|
||||||
|
bottomSpacer?: number;
|
||||||
}
|
}
|
||||||
export const PageHeader = forwardRef<HTMLDivElement, PageHeaderProps>(
|
export const PageHeader = forwardRef<HTMLDivElement, PageHeaderProps>(
|
||||||
function PageHeader(
|
function PageHeader(
|
||||||
@ -59,6 +68,8 @@ export const PageHeader = forwardRef<HTMLDivElement, PageHeaderProps>(
|
|||||||
prefixStyle,
|
prefixStyle,
|
||||||
suffixClassName,
|
suffixClassName,
|
||||||
suffixStyle,
|
suffixStyle,
|
||||||
|
bottom,
|
||||||
|
bottomSpacer,
|
||||||
...attrs
|
...attrs
|
||||||
},
|
},
|
||||||
ref
|
ref
|
||||||
@ -120,11 +131,13 @@ export const PageHeader = forwardRef<HTMLDivElement, PageHeaderProps>(
|
|||||||
{suffix}
|
{suffix}
|
||||||
</section>
|
</section>
|
||||||
</header>
|
</header>
|
||||||
|
{bottom}
|
||||||
</SafeArea>
|
</SafeArea>
|
||||||
|
|
||||||
{/* Spacer */}
|
{/* Spacer */}
|
||||||
<SafeArea top>
|
<SafeArea top>
|
||||||
<div className={styles.headerSpacer} />
|
<div className={styles.headerSpacer} />
|
||||||
|
{bottom ? <div style={{ height: bottomSpacer ?? 0 }} /> : null}
|
||||||
</SafeArea>
|
</SafeArea>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -94,14 +94,6 @@ export const journalIconButton = style({
|
|||||||
display: 'flex',
|
display: 'flex',
|
||||||
});
|
});
|
||||||
|
|
||||||
export const journalDatePickerSticky = style({
|
export const journalDatePicker = style({
|
||||||
background: cssVarV2('layer/background/primary'),
|
background: cssVarV2('layer/background/primary'),
|
||||||
position: 'sticky',
|
|
||||||
zIndex: 1,
|
|
||||||
top: 56,
|
|
||||||
selectors: {
|
|
||||||
'&[data-standalone]': {
|
|
||||||
top: 'calc(44px + env(safe-area-inset-top, 12px))',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
@ -253,6 +253,17 @@ const MobileDetailPage = ({
|
|||||||
<PageHeaderMenuButton />
|
<PageHeaderMenuButton />
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
bottom={
|
||||||
|
date ? (
|
||||||
|
<JournalDatePicker
|
||||||
|
date={date}
|
||||||
|
onChange={handleDateChange}
|
||||||
|
withDotDates={allJournalDates}
|
||||||
|
className={styles.journalDatePicker}
|
||||||
|
/>
|
||||||
|
) : null
|
||||||
|
}
|
||||||
|
bottomSpacer={94}
|
||||||
>
|
>
|
||||||
{date ? (
|
{date ? (
|
||||||
<span className={bodyEmphasized}>
|
<span className={bodyEmphasized}>
|
||||||
@ -260,19 +271,6 @@ const MobileDetailPage = ({
|
|||||||
</span>
|
</span>
|
||||||
) : null}
|
) : null}
|
||||||
</PageHeader>
|
</PageHeader>
|
||||||
{date ? (
|
|
||||||
<JournalDatePicker
|
|
||||||
date={date}
|
|
||||||
onChange={handleDateChange}
|
|
||||||
withDotDates={allJournalDates}
|
|
||||||
className={styles.journalDatePickerSticky}
|
|
||||||
data-standalone={
|
|
||||||
environment.isPwa || BUILD_CONFIG.isAndroid || BUILD_CONFIG.isIOS
|
|
||||||
? ''
|
|
||||||
: undefined
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
) : null}
|
|
||||||
<DetailPageImpl />
|
<DetailPageImpl />
|
||||||
{date ? (
|
{date ? (
|
||||||
<AppTabs background={cssVarV2('layer/background/primary')} />
|
<AppTabs background={cssVarV2('layer/background/primary')} />
|
||||||
|
Loading…
Reference in New Issue
Block a user