Skip to content
This repository was archived by the owner on Jun 20, 2022. It is now read-only.

Commit a60351a

Browse files
committed
fix: fix down
1 parent b430bbc commit a60351a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/utils.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,10 @@ export const up = (name, code) => props => {
5959
}
6060

6161
export const down = (name, code) => props => {
62-
const value = getBreakpointMax(name, props)
63-
if (value === null) return code
62+
const next = getNextBreakpoint(name, props)
63+
const previous = getPreviousBreakpoint(name, props)
64+
const value = getBreakpointMax(previous, props)
65+
if (next === null) return code
6466
return css`
6567
@media (max-width: ${value}px) {
6668
${code};
@@ -82,7 +84,7 @@ export const between = (lower, upper, code) => props => {
8284
`
8385
}
8486
if (max === null) return up(lower, code)(props)
85-
if (min === null) return down(upperPrevious, code)(props)
87+
if (min === null) return down(upper, code)(props)
8688
return null
8789
}
8890

src/utils.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ describe('utils', () => {
130130
const wrapper = shallowWithTheme(<Dummy />)
131131
expect(wrapper).toHaveStyleRule('color', 'blue')
132132
expect(wrapper).toHaveStyleRule('color', 'red', {
133-
media: '(max-width:29.98px)',
133+
media: '(max-width:9.98px)',
134134
})
135135
})
136136

0 commit comments

Comments
 (0)