Revert handle to the top of the sheet; recalibrate collapsed/dock snaps for handle+search and 2-line action labels; scroll ↓ collapses and ↑ re-docks; collapsed keeps a placeholder-less search peek that expands on focus. Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
/** Collapsed peek — handle + discreet search (no action strip). */
|
|
export const QUICK_ACTIONS_SNAP_COLLAPSED = '6.5rem' as const
|
|
|
|
/** Dock — handle + action strip (2-line labels) + global search. */
|
|
export const QUICK_ACTIONS_SNAP_DOCK = '15rem' as const
|
|
|
|
/**
|
|
* Scroll delta past this threshold on `campaign-content-scroll` collapses (↓)
|
|
* or re-docks (↑) the drawer.
|
|
*/
|
|
export const QUICK_ACTIONS_SCROLL_COLLAPSE_THRESHOLD_PX = 24
|
|
|
|
export const QUICK_ACTIONS_SNAP_POINTS = [
|
|
QUICK_ACTIONS_SNAP_COLLAPSED,
|
|
QUICK_ACTIONS_SNAP_DOCK,
|
|
] as const
|
|
|
|
export type QuickActionsSnapPoint = (typeof QUICK_ACTIONS_SNAP_POINTS)[number]
|
|
|
|
export type QuickActionsScrollDirection = 'up' | 'down' | 'none'
|
|
|
|
export const quickActionsSnapIsDock = (snap: QuickActionsSnapPoint | null): boolean =>
|
|
snap === QUICK_ACTIONS_SNAP_DOCK
|
|
|
|
/** Pure scroll-direction detector for the quick-actions peek (B105). */
|
|
export const quickActionsScrollDirection = (
|
|
previousScrollTop: number,
|
|
nextScrollTop: number,
|
|
thresholdPx: number = QUICK_ACTIONS_SCROLL_COLLAPSE_THRESHOLD_PX,
|
|
): QuickActionsScrollDirection => {
|
|
const delta = nextScrollTop - previousScrollTop
|
|
if (delta > thresholdPx) return 'down'
|
|
if (delta < -thresholdPx) return 'up'
|
|
return 'none'
|
|
}
|