mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #21990 from overleaf/mf-payment-page-view-segmentation
[web] Add new segmentation for `payment-page-view` event GitOrigin-RevId: ed15ab83edc8a0642d3cec803c59a4a4437740ea
This commit is contained in:
parent
8facb017ed
commit
21f930f73b
1 changed files with 34 additions and 0 deletions
34
services/web/frontend/js/utils/screen-breakpoint.ts
Normal file
34
services/web/frontend/js/utils/screen-breakpoint.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
type BreakpointName = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'
|
||||
|
||||
type Breakpoint = {
|
||||
name: BreakpointName
|
||||
minWidth: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps window width to Bootstrap 5 breakpoint names
|
||||
* Breakpoints based on Bootstrap 5 documentation:
|
||||
* xs: 0-575px
|
||||
* sm: 576-767px
|
||||
* md: 768-991px
|
||||
* lg: 992-1199px
|
||||
* xl: 1200-1399px
|
||||
* xxl: ≥1400px
|
||||
* @param {number} width - Window width in pixels
|
||||
* @returns {BreakpointName} Bootstrap breakpoint name
|
||||
*/
|
||||
export function getBootstrap5Breakpoint(
|
||||
width: number
|
||||
): BreakpointName | undefined {
|
||||
const breakpoints: Breakpoint[] = [
|
||||
{ name: 'xxl', minWidth: 1400 },
|
||||
{ name: 'xl', minWidth: 1200 },
|
||||
{ name: 'lg', minWidth: 992 },
|
||||
{ name: 'md', minWidth: 768 },
|
||||
{ name: 'sm', minWidth: 576 },
|
||||
{ name: 'xs', minWidth: 0 },
|
||||
]
|
||||
|
||||
const breakpoint = breakpoints.find(bp => width >= bp.minWidth)
|
||||
return breakpoint?.name
|
||||
}
|
Loading…
Reference in a new issue