Files
t3code/apps/web/src/components/composerFooterLayout.ts

25 lines
846 B
TypeScript

export const COMPOSER_FOOTER_COMPACT_BREAKPOINT_PX = 620;
export const COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX = 780;
export const COMPOSER_PRIMARY_ACTIONS_COMPACT_BREAKPOINT_PX =
COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX;
export function shouldUseCompactComposerFooter(
width: number | null,
options?: { hasWideActions?: boolean },
): boolean {
const breakpoint = options?.hasWideActions
? COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX
: COMPOSER_FOOTER_COMPACT_BREAKPOINT_PX;
return width !== null && width < breakpoint;
}
export function shouldUseCompactComposerPrimaryActions(
width: number | null,
options?: { hasWideActions?: boolean },
): boolean {
if (!options?.hasWideActions) {
return false;
}
return width !== null && width < COMPOSER_PRIMARY_ACTIONS_COMPACT_BREAKPOINT_PX;
}