Skip to content

Commit

Permalink
chore: fix improve types for getBreakpointWidth util function
Browse files Browse the repository at this point in the history
  • Loading branch information
DSil committed Apr 4, 2024
1 parent d7434ec commit 2555d82
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions packages/orbit-components/src/utils/mediaQuery/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,9 @@ export const TOKEN = {
largeDesktop: "widthBreakpointLargeDesktop",
} as const;

export interface GetBreakpointWidth {
(name: keyof typeof TOKEN, theme: Theme): string;
(name: keyof typeof TOKEN, theme: Theme, pure: false): string;
(name: keyof typeof TOKEN, theme: Theme, pure: true): number;
}

export const getBreakpointWidth: GetBreakpointWidth = (
name: string,
theme: Theme,
pure?: boolean,
) => {
export function getBreakpointWidth(name: keyof typeof TOKEN, theme: Theme): string;
export function getBreakpointWidth(name: keyof typeof TOKEN, theme: Theme, pure: false): string;
export function getBreakpointWidth(name: keyof typeof TOKEN, theme: Theme, pure: true): number;
export function getBreakpointWidth(name: keyof typeof TOKEN, theme: Theme, pure?: boolean) {
return pure ? theme.orbit[TOKEN[name]] : `(min-width: ${theme.orbit[TOKEN[name]]}px)`;
};
}

0 comments on commit 2555d82

Please sign in to comment.