Skip to content

Commit 3725b9a

Browse files
committed
chore: Export breakpoints and useMobile hook from main internal export path
1 parent c4caf56 commit 3725b9a

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/internal/breakpoints.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
export type Breakpoint = 'default' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl';
55

6-
const BREAKPOINT_MAPPING: [Breakpoint, number][] = [
6+
export const breakpoints: [Breakpoint, number][] = [
77
['xl', 1840],
88
['l', 1320],
99
['m', 1120],
@@ -12,5 +12,3 @@ const BREAKPOINT_MAPPING: [Breakpoint, number][] = [
1212
['xxs', 465],
1313
['default', -1],
1414
];
15-
16-
export const mobileBreakpoint = BREAKPOINT_MAPPING.filter(b => b[0] === 'xs')[0][1];

src/internal/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,5 @@ export { default as Portal, PortalProps } from './portal';
4141
export { useMergeRefs } from './use-merge-refs';
4242
export { useRandomId, useUniqueId } from './use-unique-id';
4343
export { validateProps } from './base-component/validate-props';
44+
export { useMobile } from './use-mobile';
45+
export { Breakpoint, breakpoints } from './breakpoints';

src/internal/use-mobile/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33

44
import { createSingletonState } from '../singleton-handler';
55

6-
import { mobileBreakpoint } from '../breakpoints';
6+
import { breakpoints } from '../breakpoints';
77
import { safeMatchMedia } from '../utils/safe-match-media';
88

99
export const forceMobileModeSymbol = Symbol.for('awsui-force-mobile-mode');
1010

11+
const mobileBreakpoint = breakpoints.filter(b => b[0] === 'xs')[0][1];
12+
1113
function getIsMobile() {
1214
// allow overriding the mobile mode in tests
1315
// any is needed because of this https://github.com/microsoft/TypeScript/issues/36813

0 commit comments

Comments
 (0)