Skip to content

Commit 3924d3c

Browse files
CesarLanderosRomanHotsiy
authored andcommitted
fix: fix the media queries utils so it gets the values from the current theme (#420)
1 parent f30a92b commit 3924d3c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/styled-components.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as styledComponents from 'styled-components';
22

3-
import theme, { ThemeInterface } from './theme';
3+
import { ThemeInterface } from './theme';
44

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

@@ -24,23 +24,23 @@ const {
2424
export const media = {
2525
lessThan(breakpoint) {
2626
return (...args) => css`
27-
@media (max-width: ${theme.breakpoints[breakpoint]}) {
27+
@media (max-width: ${props => props.theme.breakpoints[breakpoint]}) {
2828
${(css as any)(...args)};
2929
}
3030
`;
3131
},
3232

3333
greaterThan(breakpoint) {
3434
return (...args) => css`
35-
@media (min-width: ${theme.breakpoints[breakpoint]}) {
35+
@media (min-width: ${props => props.theme.breakpoints[breakpoint]}) {
3636
${(css as any)(...args)};
3737
}
3838
`;
3939
},
4040

4141
between(firstBreakpoint, secondBreakpoint) {
4242
return (...args) => css`
43-
@media (min-width: ${theme.breakpoints[firstBreakpoint]}) and (max-width: ${theme.breakpoints[
43+
@media (min-width: ${props => props.theme.breakpoints[firstBreakpoint]}) and (max-width: ${props => props.theme.breakpoints[
4444
secondBreakpoint
4545
]}) {
4646
${(css as any)(...args)};

0 commit comments

Comments
 (0)