Skip to content

Commit

Permalink
feat: add import BpProps
Browse files Browse the repository at this point in the history
  • Loading branch information
mg901 committed Feb 7, 2019
1 parent 45f7402 commit dbce067
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import { calcMinWidthInPx, calcMaxWidthInPx } from './calculators';
import { withMinMedia, withMaxMedia, withMinAndMaxMedia } from './HOFs';
import type { Props } from './models';
import type { BpProps } from './models';

type Up = (string) => (Props) => string;
export type { BpProps } from './models';

type Up = (string) => (BpProps) => string;
export const up: Up = (breakName) => ({ theme }) =>
withMinMedia(
calcMinWidthInPx(
Expand All @@ -14,7 +16,7 @@ export const up: Up = (breakName) => ({ theme }) =>
),
);

type Down = (string) => (Props) => string;
type Down = (string) => (BpProps) => string;
export const down: Down = (breakName) => ({ theme }) =>
withMaxMedia(
calcMaxWidthInPx(
Expand All @@ -24,7 +26,7 @@ export const down: Down = (breakName) => ({ theme }) =>
),
);

type Between = (string, string) => (Props) => string;
type Between = (string, string) => (BpProps) => string;
export const between: Between = (minBreak, maxBreak) => ({ theme }) =>
withMinAndMaxMedia(
calcMinWidthInPx(
Expand All @@ -39,7 +41,7 @@ export const between: Between = (minBreak, maxBreak) => ({ theme }) =>
),
);

type Only = (string) => (Props) => string;
type Only = (string) => (BpProps) => string;
export const only: Only = (breakName) => ({ theme }) =>
withMinAndMaxMedia(
calcMinWidthInPx(
Expand Down
2 changes: 1 addition & 1 deletion src/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ export type CustomBreakpoints = {
breakpoints?: BreakpointsMap,
};

export type Props = {
export type BpProps = {
theme: CustomBreakpoints,
};

0 comments on commit dbce067

Please sign in to comment.