Skip to content

Commit

Permalink
fix: fix the media queries utils so it gets the values from the curre…
Browse files Browse the repository at this point in the history
…nt theme (#420)
  • Loading branch information
CesarLanderos authored and RomanHotsiy committed Feb 25, 2018
1 parent f30a92b commit 3924d3c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/styled-components.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as styledComponents from 'styled-components';

import theme, { ThemeInterface } from './theme';
import { ThemeInterface } from './theme';

export type StyledFunction<T> = styledComponents.ThemedStyledFunction<T, ThemeInterface>;

Expand All @@ -24,23 +24,23 @@ const {
export const media = {
lessThan(breakpoint) {
return (...args) => css`
@media (max-width: ${theme.breakpoints[breakpoint]}) {
@media (max-width: ${props => props.theme.breakpoints[breakpoint]}) {
${(css as any)(...args)};
}
`;
},

greaterThan(breakpoint) {
return (...args) => css`
@media (min-width: ${theme.breakpoints[breakpoint]}) {
@media (min-width: ${props => props.theme.breakpoints[breakpoint]}) {
${(css as any)(...args)};
}
`;
},

between(firstBreakpoint, secondBreakpoint) {
return (...args) => css`
@media (min-width: ${theme.breakpoints[firstBreakpoint]}) and (max-width: ${theme.breakpoints[
@media (min-width: ${props => props.theme.breakpoints[firstBreakpoint]}) and (max-width: ${props => props.theme.breakpoints[
secondBreakpoint
]}) {
${(css as any)(...args)};
Expand Down

0 comments on commit 3924d3c

Please sign in to comment.